Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_espanol thread: ayuda con paginacion


Message #1 by =?iso-8859-1?q?abiezer=20matos?= <negrabichuela@y...> on Wed, 27 Nov 2002 11:35:30 -0600 (CST)
hola ya encontre la solucion:

no se porque pero debo darle el binding al datagrid en el page_load..

Dim DS As New DataSet()
      Dim Command As New OleDbDataAdapter()
      Dim selectcommand As String
      selectcommand = "SELECT RequisicionID, Asunto, Producto, 
Descripcion, Fecha, Usuario " & _
                      "FROM requisicion WHERE estado = 0"
      Command = New OleDbDataAdapter(selectcommand, Connection)
      Command.Fill(DS, "requisicion")
      MyDataGrid.DataSource = DS.Tables("requisicion").DefaultView
      MyDataGrid.DataBind()



> tengo una pagina de consulta donde se buscan unos
datos en un grid el cual funciona, pero lo he puesto a
pagingar y solo muestra la primera pagina de datos
cuando intento ir a la segunda desaraperece..

tienen alguna sugerencia???

------------------------Codigo-------------------------
aqui pongo el codigo de mi boton buscar y el evento
del datagri indexchange:

Private Sub Buscar_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Buscar.Click

      Dim table1 As Table
      Dim SelectCommand As String
      Dim Condcion As String
      Dim DS As DataSet
      Dim connectionString = "File
name=c:\Helpdesk.udl"
      Dim Connection As OleDbConnection = New
OleDbConnection(connectionString)
      Dim Command As OleDbDataAdapter

      SelectCommand = "SELECT RequisicionID, Asunto,
Producto, Descripcion, Fecha, Usuario " & _
                      "FROM requisicion"

      Select Case Radiolist.SelectedIndex
         Case 0
            Condcion = " where 
cast(convert(char(10),Fecha,101)  as datetime) = '" &
_
                        ConvertirFecha(txtbusca.Text)
& "' order by Fecha"
         Case 1
            Condcion = " where  Asunto LIKE '" &
txtbusca.Text & "%' order by Fecha"
         Case 2
            Condcion = " where  Usuario LIKE '" &
txtbusca.Text & "%' order by Fecha"
         Case 3
            Condcion = " where  Producto LIKE '" &
txtbusca.Text & "%' order by Fecha"
         Case 4
            Condcion = " where  Descripcion LIKE '" &
txtbusca.Text & "%' order by Fecha"
      End Select

      SelectCommand = SelectCommand & Condcion
      Command = New OleDbDataAdapter(SelectCommand,
Connection)

      DS = New DataSet()
      Command.Fill(DS, "requisicion")
      MyDataGrid.DataSource =
DS.Tables("requisicion").DefaultView
      MyDataGrid.DataBind()
   End Sub

   Private Sub MyDataGrid_PageIndexChanged(ByVal
source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs)
Handles MyDataGrid.PageIndexChanged

      'Esto es para que el datagrid pueda paginar y
refresque cuando haya algun cambio en la data
      MyDataGrid.CurrentPageIndex = e.NewPageIndex
      DataBind()

   End Sub

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

  Return to Index