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

RadGrid & NeedDatasource Absurd behavior - Viewstate=false & Item/Delete Command Event Handlers

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zepp
Top achievements
Rank 1
Zepp asked on 20 Aug 2015, 07:25 AM

I have wasted almost 20 hours over this. 

My grid was not binding data when I used NeedDataSource. When I used Basic DataBinding on PageLoad/PreRender, My Item command event fired, but Delete Command event handler didn't and showed this error:

"" Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback or callback argument. ​
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.​  ""

For that I had to use NeedDataSource as I read on forum that we need to use NeedDataSource for that. When I used NeedDataSource my grid didnt show any data.

My grid is in a RadTabStrip. At first when the page is loaded, the grid tab is not selected. However the NeedDataSource executes & sets DataSource to null because a reuired queryString value is not present on first page load. Then I append a queryString value and press enter, again NeedDataSource gets called & this time binds the grid with the queryString parameter, however the RadTabstrip that contains the grid is still not selected and some other tab is selected on page load. Now when select the tab that contains the grid, NeedDataSource doesnt get called, and there s nothing in place of the grid (The grid is not bound to any data).  

 

I wasted so many office hours on this, but to no avail. I created a separate sample project for you to assess, however the issue did not occur in that sample. And trust me when I say this, I replicated each and everything in that sample, each and every property was exactly the same as was in my initial project, but in the sample the Grid showed data, I even replicated the RadTabStrip process to ensure that the events get called in exactly that same manner.

 

The Soultion:

Just 5 minutes ago I set MasterTableView's EnableViewState property to false. This solved the problem, Grid gets bond with data, NeedDataSoruce gets called everytime, Delete & Item Command event handler execute just fine. BUT in my sample project, I did not set EnableViewState=false of MasterViewTable tag. 

Why wasnt the issue replicated in that project & why is this absurd behavior happening? Too much time wasted for just a petty issue, setting one property made it work in one project, however in another project the issue didnt occur at all. What is the possible reason kindly elaborate. What is the drawback of using EnableViewState = false of masterViewTable other than hitting the DB every time & is there any other way than setting ViewState to false.

 

Regards,

Zepp.

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 25 Aug 2015, 06:34 AM
Hi Zepp,

I am afraid based on the provided information will be hard to pinpoint the reason for that behavior. Could you please send your code declaration and the related code behind in order to observer the issue locally? This way we can try to replicate the issue and track down the cause for it.

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Zepp
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or