reset the grid setting

3 posts, 0 answers
  1. Mohammed
    Mohammed avatar
    87 posts
    Member since:
    Aug 2011

    Posted 22 Oct 2012 Link to this post

    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. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Oct 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mohammed
    Mohammed avatar
    87 posts
    Member since:
    Aug 2011

    Posted 25 Oct 2012 Link to this post

    thanks very much Eyup,
    Regards,
    Mohammed
Back to Top