This example demonstrates how to handle the grid's ClientLayout
event to save and restore the grid's client layout. The modified layouts are added to a list box editor.
The main idea is to handle the grid's server-side ClientLayout event to save the modified client layout to a Dictionary<string, string>
and add the layout to a list box editor. Then, a user can choose the layout from the editor and apply it to the grid.
protected void Grid_ClientLayout(object sender, ASPxClientLayoutArgs e) {
if (e.LayoutMode == ClientLayoutMode.Saving && isSaveLayout) {
string key = DateTime.Now.ToString();
string layout = e.LayoutData;
Dictionary<string, string> dictionary = Session["layout"] as Dictionary<string, string>;
if (!dictionary.ContainsValue(layout)) {
ListBox.Items.Add(key, layout);
dictionary[key] = layout;
}
else {
Session["selectedLayout"] = layout;
}
Session["layout"] = dictionary;
}
}
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
(you will be redirected to DevExpress.com to submit your response)