Allow Paging In RadGrid

2 posts, 0 answers
  1. dotnetrockerzzz
    dotnetrockerzzz avatar
    32 posts
    Member since:
    Aug 2010

    Posted 19 Dec 2010 Link to this post

    I am using Item Template which is binded by code behind
    (dt is a datatable which i have define above).
    RadGrid1.DataSource = dt;
    RadGrid1.DataBind();
    But the problem is i am unable to enable proper paging in the following . Can anyone help me ???
    Here is the Code :
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"
                        Skin="Office2007" Width="750px" AllowPaging="True" GridLines="None"
                        VirtualItemCount="2" onpageindexchanged="pgindex" >
    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
    <MasterTableView Width="100%" >
    <Columns>
    <telerik:GridTemplateColumn HeaderText="News Feed" UniqueName="News Feed" SortExpression="NewsFeed" >
    <ItemTemplate>
                                <table align="left" cellpadding="1" cellspacing="2">
                                    <tr>
                                        <td>
                                            <a href='<%#getUserHREF(Container.DataItem)%>'>
                                                <img src='<%#getSRC(Container.DataItem)%>' border="0" width="80px"  />  </a>
                                        </td>
                                        <td>
                                             </td>
                                    </tr>
                                </table>
                                <div align="justify">
                        Posted  By <%#sendname(Container.DataItem)%></b><span style="position:absolute; left:820px;">Posted On:
                                <asp:Label ID="lblSendDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"SendDate")%>'></asp:Label></span><br />
                                    <%#DataBinder.Eval(Container.DataItem, "Message")%>
                                    <br />
                                    <br />
                                </div>
                                  
                                </span>
                      </ItemTemplate>
                        
                    </telerik:GridTemplateColumn>
                    </Columns></MasterTableView>
                        <PagerStyle Wrap="True" />
                    </telerik:RadGrid>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Dec 2010 Link to this post

    Hello Vaibhav,


    Use the NeedDataSource event of radgrid to populate the grid, which is called "Advanced DataBinding" technique. The advantages of using this event is that you do not need to write any code for handling the logic about paging/sorting, filtering etc.

    Find the demo and documentation on Advanced-Databinding technique.
    Advanced Data Binding demo
    Advanced Data-binding documentation


    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top