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

Radgrid while paging

5 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kerry
Top achievements
Rank 1
Kerry asked on 29 Sep 2010, 03:27 AM
Hello I get the following error when pressing the 'Next Page' or 'Last Page' buttons on my radgrid. Pressing the page numbers works fine increasing PageSize works fine as well,  even pressing the '...' to move to the next group of pages works fine, sorting works fine too.  I"m using advanced binding where I get the Datasource on the OnNeedDatasource event but only on if (IsPostBack), I do not call DataBind() NeedDatasource event.  I only call DataBind() on the first PageLoad event because the grid loads with defaults the first time its rendered.  I've set the enableEventValidation="false" but this just hides the exception the grid will still not move to the next group of pages.  Using 2010 Q2 library.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Thanks

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 29 Sep 2010, 08:49 AM
Hello Kerry,

Can you make sure that EnableViewState property of the grid is set to true? Paging with disabled control and page ViewState is not supported.
http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html

Sincerely yours,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kerry
Top achievements
Rank 1
answered on 29 Sep 2010, 01:01 PM
Hello, setting the viewstate property to true or false doesn't seem to ,make a difference, it as not explicitly set and it looks like true is the default.  When I set this proprty for the MasterTableView no results are retuned.  Like I said previously, paging by pressing each individual page number works ok, its only when I press the Next Page or Last Page buttons. See my RadGrid markup below

<

 

telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Skin="WebBlue"

 

 

AllowSorting="True" AutoGenerateColumns="False" PageSize="20"

 

 

OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound"  EnableLinqExpressions="false"

 

 

onneeddatasource="RadGrid1_NeedDataSource" EnableViewState="true">

 

 

<HeaderContextMenu EnableTheming="True" Skin="PGC" EnableEmbeddedSkins="False">

 

 

<CollapseAnimation Duration="200" Type="OutQuint"></CollapseAnimation>

 

 

</HeaderContextMenu>

 

 

<MasterTableView DataKeyNames="JobNo" EnableViewState="false"><Columns>

 

 

<telerik:GridTemplateColumn UniqueName="ViewJobDetail"><ItemTemplate>

 

 

<asp:HyperLink ID="ViewJob" Text="View Job" runat="server"></asp:HyperLink>

 

 

</ItemTemplate>

 

 

<ItemStyle HorizontalAlign="Left"></ItemStyle>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="JobNo" ReadOnly="True" HeaderText="Job#" SortExpression="JobNo" Visible="False" UniqueName="JobNo">

 

 

<HeaderStyle HorizontalAlign="Left" ></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Left"></ItemStyle>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ClientName" ReadOnly="True" HeaderText="Client" SortExpression="ClientName" UniqueName="ClientName">

 

 

<HeaderStyle HorizontalAlign="Left" ></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Left"></ItemStyle>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Location" ReadOnly="True" HeaderText="Location" SortExpression="Location" UniqueName="Location">

 

 

<HeaderStyle HorizontalAlign="Left" ></HeaderStyle>

 

 

<ItemStyle HorizontalAlign="Left"></ItemStyle>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="JobType" ReadOnly="True" HeaderText="Job Type" SortExpression="JobType" UniqueName="JobType"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Status" ReadOnly="True" HeaderText="Status" SortExpression="Status" UniqueName="Status"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Dispatched" ReadOnly="True" HeaderText="Dispatched" SortExpression="Dispatched" UniqueName="Dispatched"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="OpenDate" ReadOnly="True" HeaderText="Open Date" SortExpression="OpenDate" UniqueName="OpenDate">

 

 

<HeaderStyle></HeaderStyle>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Station" ReadOnly="True" HeaderText="Station" SortExpression="Station" UniqueName="Station"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="PONumber" ReadOnly="True" HeaderText="P.O. #" SortExpression="PONumber" UniqueName="PONumber"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="CallID" ReadOnly="True" HeaderText="Call ID" SortExpression="CallID" UniqueName="CallID"></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="ClientNo" ReadOnly="True" HeaderText="ClientNo" SortExpression="ClientNo" Visible="False" UniqueName="ClientNo"></telerik:GridBoundColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings EnableRowHoverStyle="True" />

 

 

<FilterMenu EnableTheming="True" Skin="PGC" EnableEmbeddedSkins="False">

 

 

<CollapseAnimation Duration="200" Type="OutQuint"></CollapseAnimation>

 

 

</FilterMenu>

 

 

</telerik:RadGrid>

Thank You

 

0
Pavlina
Telerik team
answered on 01 Oct 2010, 02:10 PM
Hi Kerry,

To avoid this error you should set EnableViewState property of the MasterTableView to true:
<MasterTableView DataKeyNames="JobNo" EnableViewState="true">
        </MasterTableView>

Give it a try and let me know if further assistance is needed.

Regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kerry
Top achievements
Rank 1
answered on 02 Oct 2010, 02:23 AM
Hello thanks for your response, setting the EnableViewState="true" does solve the paging problem, the problem that misdirected me was I have a form with some search criteria fields (Date Ranges), when the user presses the 'search' button I assumed 

NeedDataSource

event would fire but it did not because the grid had data in it already (I Assume). So on the postback of the button click I was calling my LoadData routine and DataBind() which I thought was a no-no when using 'Advanced Binding' "NeedDatasource" event.  I figured out on the postback I just need to call ReBind() and then NeedDataSource will fire.

Thanks for steering me in the right direction....does this logic sound correct.

Kerry

 

0
Pavlina
Telerik team
answered on 04 Oct 2010, 02:08 PM
Hi Kerry,

Indeed NeedDataSource event fires when a call to the grid's Rebind() method takes place. Please refer to the help article below for more information about in which cases this event fires:
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html

All the best,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Kerry
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Kerry
Top achievements
Rank 1
Share this question
or