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

Reset layout to default

9 Answers 354 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tommy
Top achievements
Rank 1
Tommy asked on 20 Apr 2009, 06:22 AM
Hello,

Is there an easy way to reset the Grid Layout to its default layout?

Thanks,
Tommy

9 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 20 Apr 2009, 07:41 AM
Hello Tommy,

Currently we do not have the notion of default layout. For some properties like theme name, the default value (ControlDefault) can be considered part of the default layout, but for other properties such Columns collection it is not that easy.

You may just drag and drop a grid on your form and then save the layout and hence all properties will have the default values or you can save the layout of your grids at the moment you are considering the grids having the default layout for your application. If this does not help, please elaborate a bit more on your scenario so we can think of some solution.

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tommy
Top achievements
Rank 1
answered on 20 Apr 2009, 08:57 AM
Hi,

Yes, I thout about saving a default layout. I thought it would be good to consider the Grid as default when it displays exactly all Data and Columns from the associated DataSource and is not grouped or anithing similar. For that I had in mind that it would be great to use the DataSource somehow.
0
Nick
Telerik team
answered on 21 Apr 2009, 02:38 PM
Hello Tommy,

Thank you for writing us back. Can I help you further on that?

Best wishes,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tommy
Top achievements
Rank 1
answered on 22 Apr 2009, 05:46 AM
Is it possible to clear all Filters, make all hidden cells visible, clear the grouping, etc.,  programmatically? One click on a button and there are no custom changes anymore on the Grid, that would be great. Now the User has to do all that by hand.
0
Nick
Telerik team
answered on 22 Apr 2009, 03:59 PM
Hello Tommy,

Thank you for contacting us back. You can achieve that - you need to reset the appropriate properties or clear the collections. For instance, about the grouping you will need to clear the GroupByExpressions collection. Here is some sample code:

private void button1_Click(object sender, EventArgs e) 
    this.radGridView1.MasterGridViewTemplate.GroupByExpressions.Clear(); 

I hope that this helps.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Richard Slade
Top achievements
Rank 2
answered on 30 Jun 2009, 08:25 AM
Hello,

I too want to do the same thing, but I think it has been misunderstood.

I allow users to Save the layout of the Grid after choosing some columns on my GridView using GridView.SaveLayout and GridView.LoadLayout

I am trying to program a button that will take them back to the default layout.
Therefore, I am doing the following at the moment, but it is not working.

' Delete the Layout XML File First, then...

 

Grid.MasterGridViewTemplate.Update(GridUINotifyAction.LayoutChanged)

 

 

Grid.Refresh()

 

0
Nick
Telerik team
answered on 01 Jul 2009, 11:33 AM
Hi Richard Slade,

Thank you for contacting us. There isn't such notion as default layout, but you can choose some layout as a default one and use it in your scenario.

Perhaps I should elaborate further on save/load functionality. When you save the layout, you save the values of certain properties (e.g. Columns collection, Sorting, etc). When you load the layout the property values are restored according to the values for those properties written in the xml file. The xml file does not contain values for all properties (that is unnecessary) but only for those that are different from the default values and there are certain other limitations as well. When you delete the xml file literally from the system nothing should happen because the grid does not rely on it. If you delete the content and then use the load function, it will not find any property to restore and therefore probably nothing will change i.e. all property values should be left unchanged in the grid. 

The Update functions that you mentioned are used to update the grid visually based on the values of all grid properties which are currently set for the grid. This function does not change property values though, so it will not restore the original property values or more accurately values which you consider to be the original ones.

I think that the confusion comes from the Default Layout. The Default Layout is the one that you choose to be default.

Regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Richard Slade
Top achievements
Rank 2
answered on 03 Jul 2009, 08:38 AM
OK, thanks.
I achieved what I wanted in the end by saving the "Default" layout at the start and then letting the user save a new layout after they had chosen any new columns. If they want to revert back to the old layout, I load the xml for the original one again. I thought there may be a quicker way of getting back to the default as the initial layout does not have any idea of a loaded xml layout file.

Richard
0
Nick
Telerik team
answered on 06 Jul 2009, 08:22 AM
Hi Richard Slade,

I am glad that you implemented that feature in your application.

Do not hesitate to write us back if you have other questions.

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Tommy
Top achievements
Rank 1
Answers by
Nick
Telerik team
Tommy
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Share this question
or