Rad Grid don´t pagging

3 posts, 1 answers
  1. Hector Hernandez
    Hector Hernandez avatar
    45 posts
    Member since:
    Oct 2009

    Posted 22 Mar 2011 Link to this post

    I have one RadGrid with PageSize="5" and i populate with a dataset:
    Public Sub LlenaGrid()
          Strsql = "Select Empresa,Corr,NomPuesto,Salario from templeo where codusuario = " & Session("CodUsuario") & ""
          daData.SelectCommand = New OleDb.OleDbCommand(Strsql, cn)
          daData.Fill(dsGen, "DATA")
          GrdEmpleo.DataSource = dsGen
          GrdEmpleo.DataMember = "DATA"
      End Sub

    and the Grid work but when i move to the page No 2 or i click next page the Grid don´t show me any result, this is the html of the grid: 
    <telerik:RadGrid runat="server" ID="GrdEmpleo" PageSize="5" AutoGenerateColumns="False"
                        Width="100%" AllowSorting ="True" AllowPaging ="True" GridLines="None" TabIndex="17">
                    <PagerStyle Mode="NextPrevAndNumeric" NextPageText="Siguiente" PrevPageText="Anterior"
                     PagerTextFormat="Change page: {4} &nbsp;Pagina <strong>{0}</strong> de <strong>{1}</strong>, registros <strong>{2}</strong> a <strong>{3}</strong> de <strong>{5}</strong>."
                    <MasterTableView DataKeyNames="Empresa,Corr,NomPuesto,Salario">
                            <telerik:GridButtonColumn DataTextField="Empresa" UniqueName="Empresa" HeaderText="Empresa"></telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="Corr" UniqueName="Corr" Visible="false" HeaderStyle-Width="75px"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Nompuesto" UniqueName="NomPuesto" HeaderText="Puesto"  HeaderStyle-Width="75px"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Salario" HeaderText="Salario" HeaderStyle-Width="75px">
                        <selecting allowrowselect="True" />
                    <FilterMenu EnableTheming="true">
                        <CollapseAnimation Duration="200" Type="InOutQuint" />

    and here is the event PageIndexChanged:
    Private Sub GrdEmpleo_PageIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles GrdEmpleo.PageIndexChanged
            Catch ex As Exception
                LblMensaje.Text = ex.Message
            End Try
        End Sub

    I don´t know whats happend whit this grid, i need some helps
    thank you in advance

  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Mar 2011 Link to this post

    Hello Hector,

    The issue occurs because you are binding the grid using Simple data binding technique. If you are using any advanced feature in grid(like paging), then a better approach is binding RadGrid using "AdvancedData binding" using NeedDataSource event.

    Please go through the following documents for more on this.
    Advanced Data-binding (using NeedDataSource event)
    Grid / Advanced Data Binding

  3. Telerik UI for ASP.NET Core is out
  4. Hector Hernandez
    Hector Hernandez avatar
    45 posts
    Member since:
    Oct 2009

    Posted 25 Mar 2011 Link to this post

Back to Top