http://demos.telerik.com/aspnet-ajax/grid/examples/programming/savinggridsettingsonperuserbasis/defaultcs.aspx
My problem is that when I'm getting the column.headerStyle.width is not the right ones. What i mean by that is that only the resized column acctualy changes width value where the others just keep having the same as before resizing´, even if they do acctually change like f.eks in the example, but its probally just visual in my case.
what do I do wrong?
Here is my savesettings string:
private string SaveSettings()
{
object[] gridSettings = new object[3];
//Save groupBy
GridGroupByExpressionCollection groupByExpressions = gridInstance.MasterTableView.GroupByExpressions;
object[] groupExpressions = new object[groupByExpressions.Count];
int count = 0;
foreach(GridGroupByExpression expression in groupByExpressions)
{
groupExpressions[count] = ((IStateManager)expression).SaveViewState();
count++;
}
gridSettings[0] = groupExpressions;
//Save sort expressions
gridSettings[1] = ((
IStateManager)gridInstance.MasterTableView.SortExpressions).SaveViewState();
//Save columns order
int columnsLength = gridInstance.MasterTableView.Columns.Count + gridInstance.MasterTableView.AutoGeneratedColumns.Length;
Pair [] columnOrder = new Pair[ columnsLength ];
ArrayList allColumns = new ArrayList( columnsLength );
allColumns.AddRange(gridInstance.MasterTableView.Columns );
allColumns.AddRange(gridInstance.MasterTableView.AutoGeneratedColumns);
int i = 0;
foreach( GridColumn column in allColumns )
{
Pair p = new Pair();
p.First = column.OrderIndex;
p.Second = column.HeaderStyle.Width;
columnOrder[i] = p;
i++;
}
gridSettings[2] = columnOrder;
// Serialize and return
LosFormatter formatter = new LosFormatter();
StringWriter writer = new StringWriter();
formatter.Serialize( writer, gridSettings );
return writer.ToString();
}
Regards,
Mircea