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

Hierarchical Grid Update Problem

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tej
Top achievements
Rank 1
Tej asked on 04 Feb 2009, 05:45 AM
HI,

i am using Hierarchical grid with custum filtering.
the problem i am facing is something like this:

when i filter something in the grid and server returns the results the grid is not re-painted properly with the search results although the results returned are correct. when i use rebind method then in that case it paints the results properly but then the drill down button is throwing problem i.e.
"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.  "

please tell me how to get out of this hassle. i have seen all the example given on your web site but could not find anything related to my scenrio.

here is the code for the code behind:

 

public partial class BookRunOffBank : ViewPage

 

{

 

public AjaxOptions options = new AjaxOptions();

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

options.UpdateTargetId =

"page";

 

RadGrid1.PagerStyle.Position =

GridPagerPosition.TopAndBottom;

 

RadGrid1.MasterTableView.DataSource = ViewData[

"Companies"];

 

 

 

 

//////
//if i remove this method then drill down works but filter results are not painted...
//////
if
(this.IsPostBack)

 

RadGrid1.Rebind();

 

}

 

 

protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)

 

{

 

GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;

 

e.DetailTableView.DataSource = ViewData[

"CompanyBookRunOff"];

 

}

 

}

looking for your reply very soon.

thanks.

 

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 09 Feb 2009, 09:29 AM
Hi Tej,

May I ask you for some more information about how the custom filtering is implemented? And is there some particular reason to call  Rebind() method when PageLoad event is raised?

Basically the problem you are facing is caused of abnormal change of the ViewState during postbacks. Event validation checks the incoming values in a POST to ensure the values are recognized. In other words, saved hash values in the __EVENTVALIDATION are different from these send through POST method.

This exception can be thrown because of adding some values, which will be posted, but the ASP.NET framework doesn't know that they are legal, or in your case maybe not properly bound grid through post backs.

One of the possible, but not preferable, solution is to disable event validation.

Here is a code snippet showing how to achieve this:
Change this line: 
  
<@Page ... enableEventValidation="true"  /> 
 
To: 
 
<@Page ... validateRequest="false" enableEventValidation="false" /> 

Regards,
Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Tej
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or