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

Reset GridView Layout

16 Answers 267 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rui Martins
Top achievements
Rank 1
Rui Martins asked on 23 Jul 2010, 12:23 PM
Hi,

i´m writing because i notice that in your code to Save/Load GridView Layout -> http://www.telerik.com/help/silverlight/radgridview-how-to-saveload-gridview-layout.html the Reset is not working right, if you put a breakpoint in the Reset method you will see that the file.DeleteFile(PersistID) isn´t executing right.

I think the problem is because the IsolatedStorageFile don´t get the right location where the layout is saved...

do you already fix or notice that?

any ideia?

thanks,
Rui M.

16 Answers, 1 is accepted

Sort by
0
Rui Martins
Top achievements
Rank 1
answered on 23 Jul 2010, 05:20 PM
does anyone knows how i can do to solve this?

thanks,

Rui M.
0
Rui Martins
Top achievements
Rank 1
answered on 26 Jul 2010, 10:43 AM
hi again,

anyone on Telerik Team read my post??

thanks,

Rui M.
0
Rui Martins
Top achievements
Rank 1
answered on 26 Jul 2010, 06:28 PM
for example, in the save code you have here: http://www.telerik.com/help/silverlight/radgridview-how-to-saveload-gridview-layout.html

when reload() method is called it gives an exception too...

public void Reload()
            {
           try
                {
                    using (IsolatedStorageFile file = olatedStorageFile.GetUserStoreForApplication())
                    {
                        using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(PersistID, FileMode.Open, file))
                        {
                            if (stream.Length > 0)
                            {
                                RadGridViewApplicationSettings loaded = (RadGridViewApplicationSettings)serializer.ReadObject(stream);
 
                                FrozenColumnCount = loaded.FrozenColumnCount;
 
                                ColumnSettings.Clear();
                                foreach (ColumnSetting cs in loaded.ColumnSettings)
                                {
                                    ColumnSettings.Add(cs);
                                }
 
                                FilterSettings.Clear();
                                foreach (FilterSetting fs in loaded.FilterSettings)
                                {
                                    FilterSettings.Add(fs);
                                }
 
                                GroupSettings.Clear();
                                foreach (GroupSetting gs in loaded.GroupSettings)
                                {
                                    GroupSettings.Add(gs);
                                }
 
                                SortSettings.Clear();
                                foreach (SortSetting ss in loaded.SortSettings)
                                {
                                    SortSettings.Add(ss);
                                }
                            }
                        }
                    }
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
thanks,

Rui Martins
0
Rui Martins
Top achievements
Rank 1
answered on 27 Jul 2010, 11:59 AM
sorry my insistence but it is importante to me solve this issue!!

anyone from the support?
thanks

Rui M.
0
Tsvyatko
Telerik team
answered on 27 Jul 2010, 05:24 PM
Hello,

Please check the attachment. It demonstrates how to achieve the  desired functionlity. Note that this app is registered as full trust  app (through project settings/security).

Please let me know if this works for you.

Best wishes,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rui Martins
Top achievements
Rank 1
answered on 28 Jul 2010, 10:14 AM
thanks for the answer Tsvyatk,

you code works if you don´t close the application, but if you close it your example save the current settings and when we run the project again the default settings will be the settings that you have at the time you close the application,

this is a good think, but is it possible to have an option to restore the default original settings without any changing??

Thanks again,

Rui M.
0
Accepted
Tsvyatko
Telerik team
answered on 28 Jul 2010, 04:09 PM
Hi Rui Martins,

I have modified sample project that is able to reset to default layout using the reset button. Please have a look at it and let me know if you need any further assistance.

Sincerely yours,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rui Martins
Top achievements
Rank 1
answered on 29 Jul 2010, 12:09 PM
Hi Tsvyatko,

thank for the sample it was a great help!!

i think it´s working now, but i have another problem, when i Load my grid the column with is so small(i can´t attach the file picture to show :( ) do you have any idea why it happens? why don´t have the same with like the original one?

One more thing, my project is a Silverlight project, and i can´t use the  
using (IsolatedStorageFile file = IsolatedStorageFile.GetMachineStoreForAssembly())

because i can´t find it... so i Used this:

using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())

Is that a problem??

Thanks again,

Rui Martins
0
Rui Martins
Top achievements
Rank 1
answered on 29 Jul 2010, 04:25 PM
problem solved...

thank you :)

Rui M.
0
Pandit Prerna
Top achievements
Rank 1
answered on 29 Jul 2010, 08:48 PM
Hi,

I impelmented this code to get settings value, thanks for posting the example.

My only problem is that when it is reset, the data goes away, even though my columns are reset.

Any clues why that must be happening?
0
Rui Martins
Top achievements
Rank 1
answered on 30 Jul 2010, 03:49 PM
Hi again,

i´m trying to apply the same code to not only one, but to three RadViewGrid. my setting crash because i don´t have space for more settings, do you know how i can solve this and use the same RadGridViewSettings? maybe create a directory for each  RadGridView?

Pandit , maybe you aren´t using all the properties or the correct property to each datacolumn (in your xaml code)..like   DataMemberBinding="{Binding Something}"... just an idea for sure i´am not the right person to help you ...

thanks to all,

Rui M.
0
Tsvyatko
Telerik team
answered on 02 Aug 2010, 09:29 AM
Hi Rui Martins,
Please check this article describing how to increase our IsolatedStarage quota -http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.increasequotato%28VS.95%29.aspx.

Hi Pandit Prerna,
Currently pressing reset button resets gridview to its initial state. Pressing save saves the current state in different file, while still allows resetting the settings. You can also check the initial implementation in our QSF - http://demos.telerik.com/silverlight/#GridView/SaveLoadSettings

Greetings,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Pandit Prerna
Top achievements
Rank 1
answered on 02 Aug 2010, 10:24 PM
I had defined databinding in my xaml file and when I deserialized the object, the databinding was comming back as null.

I had to recreate databinding like this for it to work

column.DataMemberBinding =

new System.Windows.Data.Binding(setting.PropertyName)

 

0
Pandit Prerna
Top achievements
Rank 1
answered on 02 Aug 2010, 10:29 PM
I used the sample to save the settings and found out that none of the cell templates is being persisted to isolated storage. I have defined few cell templates in my xaml file. Is there a way to make them persist?

<

 

radGrid:GridViewDataColumn.CellTemplate>

 

 

 

<DataTemplate>

 

 

 

<StackPanel Margin="0,5,0,5">

 

 

 

<TextBlock Text="{Binding FilerName}" FontWeight="Bold" />

 

 

 

<TextBlock Text="{Binding Description}" />

 

 

 

</StackPanel>

 

 

 

</DataTemplate>

 

 

 

</radGrid:GridViewDataColumn.CellTemplate>

 

0
Vlad
Telerik team
answered on 03 Aug 2010, 06:45 AM
Hello,

You can check my answer here.

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
loraine
Top achievements
Rank 1
answered on 23 May 2011, 01:05 PM
hi Vlad!

it would also a good idea to save many gridview settings. Like when i click on the button, I can save the gridview settings with a name. that gridview setting will be added to the list of gridview settings. Then i may choose from those gridview settings list that i wantt to apply to the gridview. i want to implement that. how can i do that?

thanks,
Loraine
Tags
GridView
Asked by
Rui Martins
Top achievements
Rank 1
Answers by
Rui Martins
Top achievements
Rank 1
Tsvyatko
Telerik team
Pandit Prerna
Top achievements
Rank 1
Vlad
Telerik team
loraine
Top achievements
Rank 1
Share this question
or