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

reset Grid to prior state after Rebind()

2 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 2
Tim asked on 17 Jan 2012, 10:13 PM
I am rebinding a Hierarchical radgrid after closing a custom edit/insert form using the below code and javascript. I would like to reset the state of the Grid as it was when the user clicked to edit a record. Currently all childgrids close up to the master. The attached images show what I mean. EditDetailRecord.png is where I want the user to be after the Rebind(). AfterDataRebind.png is currently what they see.

protected void Page_Load(object sender, EventArgs e)
{
    RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
    manager.ClientEvents.OnRequestStart = "onRequestStart";
    manager.AjaxSettings.AddAjaxSetting(manager, this.__rejectedBatchesRadGrid);
    manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(Manager_AjaxRequest);  
 
    if (!IsPostBack) {  }
}
 
protected void Manager_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    this.__rejectedBatchesRadGrid.MasterTableView.SortExpressions.Clear();
    this.__rejectedBatchesRadGrid.MasterTableView.GroupByExpressions.Clear();
    this.__rejectedBatchesRadGrid.Rebind();
}







2 Answers, 1 is accepted

Sort by
0
Accepted
Antonio Stoilkov
Telerik team
answered on 20 Jan 2012, 07:19 PM
Hi Tim,

Note that when calling RadGrid Rebind method the grid loses all its data associated with expanded items and items in edit mode. However, you could go through the Retain expanded/selected state in hierarchy on rebind forum thread for information how you could implement persisting state after rebind.

Greetings,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Tim
Top achievements
Rank 2
answered on 02 Feb 2012, 04:51 PM
hey Antonio,
I finally had a chance to get back to this and the sample project at the link you provided did solve the objective. Thanks again.
Tags
Grid
Asked by
Tim
Top achievements
Rank 2
Answers by
Antonio Stoilkov
Telerik team
Tim
Top achievements
Rank 2
Share this question
or