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

[Solved] Rad Grid pagination (custom Paging)

1 Answer 236 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mathews
Top achievements
Rank 1
Mathews asked on 03 Jun 2008, 02:00 PM
hi
am facing problem in custom paging of grid.am returning 5 rows frm stored proc
and my page size of grid is 5 .virtual count am setting to 2 from database (number of records from that particular table is 9.)
problem is that my grid is not displaying the pager template
below is the code

<

radG:RadGrid ID="rgDepartmentList" runat="server" Width="99%" AllowPaging="True" AllowCustomPaging="true" OnPageIndexChanged="rgDepartmentList_PageIndexChanged"

AllowSorting="True" ShowStatusBar="True" GridLines="None" AutoGenerateColumns="False" PageSize="5">

<MasterTableView CommandItemDisplay="Top" DataKeyNames="dept_id" RowIndicatorColumn-Display="false">

<NoRecordsTemplate>

<table width="99%" align="center">

<tr>

<td>

No record found.

</td>

</tr>

</table>

</NoRecordsTemplate>

<RowIndicatorColumn>

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

<ExpandCollapseColumn Resizable="False" Visible="False">

<HeaderStyle Width="20px" />

</ExpandCollapseColumn>

<Columns>

<radG:GridTemplateColumn HeaderText="Edit" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="30px"

ItemStyle-Width="30px">

<ItemTemplate>

<img onclick=" NavigateToEdit('<%# Eval("dept_id") %>','<%# Eval("dept_active") %>','<%# Eval("dept_name") %>');"

style="cursor: pointer;" alt="Edit" src="../../../Images/common/edit.gif" />

</ItemTemplate>

</radG:GridTemplateColumn>

<radG:GridButtonColumn HeaderText="Delete" ButtonType="ImageButton" CommandName="Delete"

ConfirmText="Do you want to delete this record?" ImageUrl="../../../Images/common/DeleteImage.JPG"

Text="Delete" UniqueName="column1">

<HeaderStyle HorizontalAlign="Center" Width="40px" />

<ItemStyle HorizontalAlign="Center" Width="40px" />

</radG:GridButtonColumn>

<radG:GridTemplateColumn HeaderText="Active">

<ItemTemplate >

<asp:CheckBox ID="chkbox" runat="server" Checked='<%# Bind("dept_active") %>' />

</ItemTemplate>

</radG:GridTemplateColumn>

<radG:GridBoundColumn HeaderText="Department&nbsp;Name" DataField="dept_name" UniqueName="dept_name">

</radG:GridBoundColumn>

</Columns>

<CommandItemTemplate>

<table class="CommandItemTemplate" cellpadding="0" cellspacing="0" width="100%">

<tr>

<td>

<table cellpadding="0" cellspacing="0">

<tr>

<td>

&nbsp;<img alt="" src="../../../Images/common/register.gif" /></td>

<td>

<a id="A1" onclick="NavigateToAdd();" href="#">Add Department</a>

</td>

<td>

&nbsp;</td>

<td>

&nbsp;</td>

<td>

<img src="../../../Images/common/button_refresh.gif" alt="" />

</td>

<td>

<asp:LinkButton ID="lbtnRefresh" Text="Refresh" runat="server" CommandName="Refresh"

onmouseover="OnRefreshCommandMouseOver();" onmouseout="OnRefreshCommandMouseOut();"></asp:LinkButton>

</td>

<td width="*">

</td>

</tr>

</table>

</td>

</tr>

</table>

</CommandItemTemplate>

</MasterTableView>

<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>

<ClientSettings EnableClientKeyValues="True" AllowColumnsReorder="true" ApplyStylesOnClient="true"

ReorderColumnsOnClient="True">

<ClientEvents OnRowClick="" OnRowSelected="RowSelected" />

<Selecting AllowRowSelect="true" />

<Resizing AllowColumnResize="true" AllowRowResize="true" ResizeGridOnColumnResize="false"

ClipCellContentOnResize="true" EnableRealTimeResize="false" />

</ClientSettings>

</

radG:RadGrid>


Code behind is

Private

Sub LoadGrid(ByVal currentindex As Integer)

Dim totalrecords As Integer = 0

Dim ds As New DataSet

ds = SFSetupDepartments.GetDepartmentsByPage((currentindex + 1), 5, totalrecords)

With rgDepartmentList

.MasterTableView.VirtualItemCount = (totalrecords / .PageSize)

.DataSource = ds.Tables(0)

.DataBind()

End With

End Sub

 

Please let me know the same as early as possible ? thanks guys

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 06 Jun 2008, 07:21 AM
Hello Mathews,

If the returned number of records is less than the page size set for the grid, you will need to set PagerStyle -> AlwaysVisible = true in order to display the pager item regardless of the number of items. Also verify that you are using the latest hotfix 2008.1.515 of RadControls for ASP.NET AJAX.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Mathews
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or