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

Save Load Settings

2 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 23 Dec 2010, 10:15 AM
Hi,
I am using RadGridView, i am using the RadGridViewSetting.cs from the example (http://demos.telerik.com/wpf/?GridView/SaveLoadSettings)
the save and load working fine for sort, but When i filter data, the FilterDescriptors load fine but the Items.Count = 0, and i am not seeing data
in the grid. what i am doing wrong? 

I am filtering the first row, to be (a,c,e)

Code

http://www.telerik.com/ClientsFiles/238145_window1.png
http://www.telerik.com/ClientsFiles/238146_window2.png

public

 

DataTable ExcelData { getset; }

 

 


RadGridViewSettings settings = null;

 

 


public Window1()

 

{

InitializeComponent();

 

}

 


privatevoid Window_Loaded(object sender, RoutedEventArgs e)

 

{

 

ExcelData =


newDataTable();

 

ExcelData.Columns.Add(


newDataColumn("Col1"));

 

ExcelData.Columns.Add(


newDataColumn("Col2"));

 

ExcelData.Columns.Add(


newDataColumn("Col3"));

 

ExcelData.Rows.Add(


"a""a1""a2");

 

ExcelData.Rows.Add(


"b""b1""b2");

 

ExcelData.Rows.Add(


"c""c1""c2");

 

ExcelData.Rows.Add(


"d""d1""d2");

 

ExcelData.Rows.Add(


"e""e1""e2");

 

gridViewFileData.ItemsSource = ExcelData;

settings =


newRadGridViewSettings(gridViewFileData);

 

settings.LoadState();

}

 


privatevoid Button_Click(object sender, RoutedEventArgs e)

 

{

 


if (settings != null)

 

{

settings.SaveState();

}

}

}

XAML:

 

 

 


<Grid>

 

 

 


 

 

 


<StackPanel>

 

 

 


 

 

 


<telerik:RadGridView x:Name="gridViewFileData" telerik:Theming.Theme="Office_Blue"

 

 


CanUserFreezeColumns="False" IsReadOnly="True"

 

 

 


 

 


ItemsSource="{Binding Path=ExcelData}">

 

 

 


 

 

 


</telerik:RadGridView>

 

 

 


 

 

 


<Button Content="Save" Click="Button_Click"/>

 

 

 


 

 

 


</StackPanel>

 

 

 


 

 

 


</Grid>

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 28 Dec 2010, 08:24 AM
Hi,

 Can you verify if the grid is bound after reloaded? Please verify also what are applied filters - Items.Count will 0 if nothing matches the filter. 

Kind regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Dan
Top achievements
Rank 1
answered on 29 Dec 2010, 09:33 AM
Hi, i copy pasted the code i am using,
the grid is bound after reloaded and its filterdescriptors = 1
if I clear the FilterDescriptors the grid works fine 
or if i save the old FilterDescriptors in a temp Var it works fine also.
the only problem is when i read the settings from a file.
Tags
GridView
Asked by
Dan
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Dan
Top achievements
Rank 1
Share this question
or