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

RadGrid paging is not working properly

4 Answers 651 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 07 May 2013, 02:32 PM
I have a RadGrid on an aspx page that does not seem to page properly.  Any attempt at pressing any of the paging buttons (Next page, Last Page, 2nd page, 3rd page, etc) causes a small dark flash on the screen but does nothing otherwise.  A second attempt at pressing a button will cause the page to refresh without the grid even being rendered.

Really appreciate the help on this.

<telerik:RadAjaxManager ID="RadAjaxMgr" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="rGrid_Employee_Roster">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rGrid_Employee_Roster" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadGrid ID="rGrid_Employee_Roster" runat="server" CellSpacing="0"
GridLines="None" AllowPaging="true"
ShowGroupPanel="True" EnableLinqExpressions="False"
OnNeedDataSource="rGrid_Employee_Roster_NeedDataSource">
<GroupingSettings CaseSensitive="False" ShowUnGroupButton="True" />
<ClientSettings AllowDragToGroup="True"></ClientSettings>
<MasterTableView AutoGenerateColumns="False"
AllowFilteringByColumn="True" AllowSorting="True" AllowPaging="true" PageSize="18"
ShowGroupFooter="True"
NoMasterRecordsText="No employees for this Cost Center"
CommandItemDisplay="Top" EnableLinqGrouping="False">
<CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" ShowExportToExcelButton="True" ShowExportToPdfButton="True"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="EmployeeName"
FilterControlAltText="Filter EmployeeName column" HeaderText="Name"
ReadOnly="True" SortExpression="EmployeeName" UniqueName="EmployeeName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Lmp_Num"
FilterControlAltText="Filter Lmp_Num column" HeaderText="Lmp Num"
SortExpression="Lmp_Num" UniqueName="Lmp_Num" AllowFiltering="False">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Position"
FilterControlAltText="Filter Position column" HeaderText="Position"
SortExpression="Position" UniqueName="Position">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Company"
FilterControlAltText="Filter Company column" HeaderText="Company"
SortExpression="Company" UniqueName="Company">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Work_Shift_Num" DataType="System.Int32"
FilterControlAltText="Filter Work_Shift_Num column" HeaderText="Shift Num"
SortExpression="Work_Shift_Num" UniqueName="Work_Shift_Num">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Type"
FilterControlAltText="Filter Type column" HeaderText="Type" ReadOnly="True"
SortExpression="Type" UniqueName="Type">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Cost_Ctr"
FilterControlAltText="Filter Cost_Ctr column" HeaderText="Cost Ctr"
UniqueName="Cost_Ctr">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Full_Time" DataType="System.Boolean"
FilterControlAltText="Filter Full_Time column" HeaderText="Ful Time"
SortExpression="Full_Time" UniqueName="Full_Time" AllowFiltering="False">
</telerik:GridCheckBoxColumn>
<telerik:GridCheckBoxColumn DataField="Tdy_Volunteer" DataType="System.Boolean"
FilterControlAltText="Filter Tdy_Volunteer column" HeaderText="Tdy Vol"
SortExpression="Tdy_Volunteer" UniqueName="Tdy_Volunteer"
AllowFiltering="False">
</telerik:GridCheckBoxColumn>
</Columns>
<EditFormSettings><EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>

Here is the code behind:

protected void rGrid_Employee_Roster_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    this.rGrid_Employee_Roster.DataSource = EmployeeRoster.GetDataByCostCtr(Convert.ToInt32(lbl_Cost_Center_Num.Text));
}

4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 May 2013, 06:44 PM
Hello,

Please try with below code snippet.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rGrid_Employee_Roster">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rGrid_Employee_Roster" LoadingPanelID="RadAjaxLoadingPanel1">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>


Thanks,
Jayesh Goyani
0
Carlos
Top achievements
Rank 1
answered on 07 May 2013, 07:16 PM
Apologies, I do have a radmanager just didn't put it up.  Here's what I have for it.  I've also edited my original post:

<telerik:RadAjaxManager ID="RadAjaxMgr" runat="server">
     <AjaxSettings>
          <telerik:AjaxSetting AjaxControlID="rGrid_Employee_Roster">
               <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rGrid_Employee_Roster" />
               </UpdatedControls>
          </telerik:AjaxSetting>
     </AjaxSettings>
</telerik:RadAjaxManager>
0
Viktor Tachev
Telerik team
answered on 10 May 2013, 11:48 AM
Hello Carlos,

I am afraid that I was unable to reproduce the behavior you describe.

You would find attached the sample project I used for test. It includes the RadGrid settings from the code you have provided. The grid rebinds as expected.

If this is not helpful could you share your full page source code along with the code behind. This will allow me to further investigate what is casing the behavior you describe.

I am looking forward to your reply.

Regards,
Victor Tachev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Tim
Top achievements
Rank 1
answered on 16 May 2013, 09:55 PM


Carlos,

  I just solved the same issue about 30 minutes ago... My page was also doing the flash and that was the page hitting the code behind for ItemCommand and trying to run a command. From my Google search it appears that this has been a problem for a while.  What led me to resolve the issue was someone, back in 2011, posted that their pager had stopped working after adding a radgrid_ItemCommand function in the code behind.

  I had just recently changed mine and once I put back the changes it started to work again.

  So here WAS my code behind for RadGrid_ItemCommand
private void RadGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
  DownloadFile(e.CommandArgument.ToString());
}

If you have a ItemCommand function it appears that you must capture the events and only send the comments that you want processed. If you don't then the page post back eats the ajax command and sends your pager click off to some function that it should not be going to.

Once I changed the code to this;
private void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
 if (e.CommandName.ToString() == "Download")
 {
  DownloadFile(e.CommandArgument.ToString());
 }
}

Everything started working again as it should.


Tim Sapp
Dallas Texas
Tags
Grid
Asked by
Carlos
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Carlos
Top achievements
Rank 1
Viktor Tachev
Telerik team
Tim
Top achievements
Rank 1
Share this question
or