Radgrid Paging is not working
Hello!
I bind my grid using sqldatasource and grid having item databound event as well but the paging is nnot working here...please review the code and tell me what is wrong...?
<telerik:RadGrid ID="gvDocuments" Width="90%" runat="server" DataSourceID="sdsDocuments"
AutoGenerateColumns="False" GridLines="Vertical" AllowPaging="true" PageSize="2" ViewStateMode="Enabled"
OnItemCommand="gvDocuments_ItemCommand" >
<MasterTableView DataKeyNames="ID">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<Columns>
<telerik:GridBoundColumn HeaderText="ID" DataField="ID" DataType="System.Int32" ReadOnly="True"
SortExpression="ID" UniqueName="ID" Display="false" />
<telerik:GridTemplateColumn ItemStyle-CssClass="gridActions" ItemStyle-HorizontalAlign="Center"
ItemStyle-Height="70" ItemStyle-Width="50" HeaderStyle-Width="80px">
<ItemTemplate>
<img height="60" width="50" src="<%#((Convert.ToString(Eval("Url")).Contains(".doc") || Convert.ToString(Eval("Url")).Contains(".docx")) ? "/Common/Images/Custom/doc.gif" : ((Convert.ToString(Eval("Url")).Contains(".pdf")) ? "/Common/Images/Custom/pdf.gif" :"/Common/Images/Custom/file.png" ))%>" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="Title" DataType="System.Int32" HeaderText="Title"
SortExpression="Title" UniqueName="Title" HeaderStyle-Width="150px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Url" DataType="System.Int32" HeaderText="Name"
SortExpression="Url" UniqueName="Url" HeaderStyle-Width="150px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Language" DataType="System.Int32" HeaderText="Language"
SortExpression="Language" UniqueName="Language" HeaderStyle-Width="100px" ItemStyle-HorizontalAlign="Center"
HeaderStyle-HorizontalAlign="Center">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description"
UniqueName="Description" HeaderStyle-Width="150px">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-CssClass="gridActions" HeaderStyle-Width="50px"
HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="btn_Edit" CommandArgument='<%#Eval("ID") %>' CommandName="edit" Height="20" Width="20"
runat="server" ImageUrl="/Common/Images/Custom/icon_edit.gif" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn ItemStyle-CssClass="gridActions" HeaderStyle-Width="50px"
HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="btn_Delete" CommandArgument='<%#Eval("ID") %>' CommandName="delete"
runat="server" ImageUrl="/Common/Images/Custom/btn_icon_delete.gif" Height="20" Width="20" OnClientClick="return confirm('Are you sure you want to delete all the records ?');" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="PageCount" HeaderText="Total Associated Products"
SortExpression="PageCount" UniqueName="PageCount" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center" ItemStyle-Font-Size="Large" ItemStyle-ForeColor="Green">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-CssClass="gridActions" HeaderStyle-Width="50px"
HeaderText="Associated Products" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="btn_showProductDoc" CommandArgument='<%#Eval("ID") %>' CommandName="AssociatedPages"
runat="server" ImageUrl="/Common/Images/Custom/arrow.png" Height="35" Width="35" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn ItemStyle-CssClass="gridActions" HeaderStyle-Width="50px"
HeaderText="Add New Product" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="btn_NewProductDoc" CommandArgument='<%#Eval("ID") %>' CommandName="AddNewProduct"
runat="server" ImageUrl="/Common/Images/Custom/New.png" Height="35" Width="35" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn ItemStyle-CssClass="gridActions" HeaderStyle-Width="30px"
HeaderText="Download" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<a href="<%# ("/Common/Documents/"+ Eval("ID")+"/"+Eval("Url")) %>">
<img src="/Common/Images/Custom/download.png" height="40" width="35" />
</a>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
Please tel me ASAP
Thanks!
Hi waqar,
I sent a reply to you here.
Greetings,
Ivan Dimitrov
the Telerik team