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

When trying to navigate to page 2 in tRadGrid control I get an exception

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tanya
Top achievements
Rank 1
Tanya asked on 14 May 2014, 12:28 PM
ello I've got some problem wih the paging of Telerik RadGrid Control! When it's first page - there is no problem it loads me three rows as I have givenpageSize property value - "3". But when I try to get to the second page - it gives me an error:

39e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404


Here is my aspx file

<
telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowCustomPaging="false" AllowPaging="True" PageSize="3" OnPageIndexChanged="RadGrid2PageIndexChanged" OnNeedDataSource="radGridOnNeedDataSource" ><br>                          <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" PageSizeControlType="RadComboBox"></PagerStyle><br>                             <MasterTableView><br>                                <Columns><br>                                      <telerik:GridBoundColumn DataField="ArticlegroupID" HeaderText="ArticleGrouipID" UniqueName="groupID">                           <br>                                      </telerik:GridBoundColumn><br><br>                                       <telerik:GridBoundColumn DataField="SpecialWord" HeaderText="ProductDescription" UniqueName="ProductDescr" ><br>                                       </telerik:GridBoundColumn>  <br>                                       <telerik:GridImageColumn DataType="System.String" DataImageUrlFields="ImageFile"<br>                                            AlternateText="Customer image" <br>                                            ImageAlign="Middle" ImageHeight="100px" ImageWidth="82px" HeaderText="Image Column"><br>                                       </telerik:GridImageColumn>   <br>                                </Columns><br>                             </MasterTableView><br><br><br><br>                      </telerik:RadGrid>

And here is my cs File with only one function in which I get the data for datasource from a web service and bind it to the radGrid:

 protected void radGridOnNeedDataSource(object source, GridNeedDataSourceEventArgs e)    
{  RadGrid p_RadIconProducts =
this.FindControl("RadGrid1") as RadGrid;            
   List<WebServiceBeaMenu> radTileIcon =
new List<WebServiceBeaMenu>();
   
 radTileIcon = MvcBeaDAL.WebServiceBea.GetArticle(p_menuID, p_articlegroupID, 1).ToList();            p_RadIconProducts.DataSource = radTileIcon;<br>           
   p_RadIconProducts.MasterTableView.VirtualItemCount = radTileIcon.Count;<br>            p_RadIconProducts.CurrentPageIndex = p_RadIconProducts.MasterTableView.CurrentPageIndex;<br><br><br>        }

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 19 May 2014, 07:15 AM
Hi Tanya,

It seems strange that an error 404 is thrown when paging. This error is generally shown when a requested page was not found.

Would you check the PageIndexChanged handler and ensure that the code there is not the cause for the error? If the issue is not there, would you share your full markup with the code-behind so we could have better understanding of your scenario?

On a side note, the NeedDataSource event is generally used for setting the DataSource for RadGrid. It is fired every time the grid needs to be bound to a data source. You do not need to set the CurrentPageIndex or the VirtualItemsCount properties in this handler. If you would like to use custom paging you would find this online demo interesting.


Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Tanya
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or