This is a migrated thread and some comments may be shown as answers.

Allow Paging In RadGrid

1 Answer 647 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dotnetrockerzzz
Top achievements
Rank 2
dotnetrockerzzz asked on 19 Dec 2010, 03:43 PM
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>

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Dec 2010, 05:27 AM
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.
Tags
Grid
Asked by
dotnetrockerzzz
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or