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

Hierarchical Grid refresh Problem

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tejpartap Singh
Top achievements
Rank 1
Tejpartap Singh asked on 05 Feb 2009, 01:50 AM

HI Telerik Team,

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.  "

In Short i can say how to refresh the Grid without using rebind, in my case both the requests
Filter and drill down are post requests so i use isPostBack to check the request type

"Filter" works with rebind but "Drill Down" does not work with post back.

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
Yavor
Telerik team
answered on 09 Feb 2009, 01:26 PM
Hello Tejpartap,

When rebinding the grid, please do not reset its datasource. You can use the NeedDataSource event handler. After you have called Rebind(), the control will raise NeedDataSource, where you can alter the data passed to the control. Setting the datasource on page load will break the control's functionality.

Kind regards,
Yavor
the Telerik team

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