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

reset the grid setting

2 Answers 330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 2
Mohammed asked on 23 Oct 2012, 02:00 AM
Hi team,
how we can reset the grid setting to the default after loading the saved settings.
we want to have a "Reset" column which return the grid to the default settings.
Regards.
Mohammed

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 25 Oct 2012, 03:33 PM
Hi Mohammed,

Thank you for contacting us.

The ViewState preserves any change made to RadGrid and prevents loosing any client side made modification - paging, grouping, sorting and so on. I am afraid there is no command out-of-box to cause the grid to regain its initial state. However, you can reset its specific properties on a given event:
Copy Code
protected void Button1_Click(object sender, EventArgs e)
   {
       RadGrid1.MasterTableView.SortExpressions.Clear();
       RadGrid1.MasterTableView.GroupByExpressions.Clear();
       RadGrid1.CurrentPageIndex = 0;
       RadGrid1.MasterTableView.FilterExpression = "";
       RadGrid1.EditIndexes.Clear();
       RadGrid1.MasterTableView.IsItemInserted = false;
       RadGrid1.Rebind();
   }
As for reordering columns, you will need to do it conditionally by keeping the reordered index:
Copy Code
RadGrid1.MasterTableView.SwapColumns(2, 4);
RadGrid1.MasterTableView.SwapColumns("Column1", "Column2");
Please note that the columns' indexes could start from 2.

I hope this was helpful. Let me know if you have any other questions.

All the best,
Eyup
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
Mohammed
Top achievements
Rank 2
answered on 26 Oct 2012, 03:31 AM
thanks very much Eyup,
Regards,
Mohammed
Tags
Grid
Asked by
Mohammed
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Mohammed
Top achievements
Rank 2
Share this question
or