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

How do SaveLayout() and LoadLayout() work?

4 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dave Gasner
Top achievements
Rank 1
Dave Gasner asked on 07 Jan 2009, 10:53 PM
Maybe I'm crazy, or maybe I'm blind, but I can't seem to find a good example on how to get the LoadLayout to work.

I have a grid, and I save the layout to a file, using SaveLayout(fileName), but then when I go to load it, the method throws the exception:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


I figured that I was just doing it incorrectly, but when I went to look for an example of some sort, I couldn't find one.
Can someone please help me out with this.

Thanks
Davey

4 Answers, 1 is accepted

Sort by
0
erwin
Top achievements
Rank 1
Veteran
answered on 07 Jan 2009, 10:59 PM

Make sure Data Bind occurs before LoadLayout().

However, there are probably still some issues with specific complex grid layouts. Basic grids seem to work quite well (tested quite a bit with 2008Q3SP1).

If things do not work out, please post more information / code snipped on how you set up the grid.

Regards Erwin




0
Dave Gasner
Top achievements
Rank 1
answered on 08 Jan 2009, 04:41 PM
Ok, so before posting a bunch of code, I thought I'd ask some questions to maybe fill me in on what "exactly" SaveLayout and LoadLayout can actually do.

I build my columns dynamically in my grid.  I was hoping that instead of building my own logic to store the column info, sort info, and grouping info, and then later try and go get it and apply it to my grid (as I've done in ASPX), I could just do the SaveLayout() LoadLayout().

Are my wishes far above what the SaveLayout() and LoadLayout() can do?

Thanks
Davey
0
erwin
Top achievements
Rank 1
Veteran
answered on 09 Jan 2009, 09:00 AM
Dave,

That's exactly what these functions are meant to do (if they work).
I have no experience with these functions with manually set-up grids, only with grids that use databinding.

Some more fine-grained control of exactly what aspects of the grid are saved is currently lacking or at least undocumented.

Regards
Erwin
0
Nikolay
Telerik team
answered on 13 Jan 2009, 05:19 PM
Hi guys,

Erwin, thank you for your feedback and cooperation.

Dave Gasner, as Erwin mentioned, the purpose of the Save/Load Layout feature is to persist RadGridView properties. For additional information, please refer to the following forum thread:
http://admin.telerik.com/default.aspx?Context=Support&Control=~/UserControls/Support/ThreadReply.ascx&ST=181676&SM=0

As mentioned there, you will provide documentation soon.

There is a good example of the regarded feature in our Quick Start Framework application (a.k.a. Examples), section RadGridView >> Save/Load Layout.

Dave Gasner, if you continue experiencing the issue described at the beginning of this thread, please open a new support ticket and send me a sample project which reproduces it. This will allow me to help you further.

Kind regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Dave Gasner
Top achievements
Rank 1
Answers by
erwin
Top achievements
Rank 1
Veteran
Dave Gasner
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or