I save RadGridView layout in SQL using the following code:
string
name = Microsoft.VisualBasic.Interaction.InputBox(
"Please insert the layout name:"
,
" "
);
using
(MemoryStream ms =
new
MemoryStream())
{
var lay =
new
Rahat.Layout();
lay.User_Id = 123;
lay.Title = name;
#region lay.Layout
grid.SaveLayout(ms);
var sw =
new
StreamWriter(ms);
sw.Flush();
ms.Position = 0;
var sr =
new
StreamReader(ms);
var myStr = sr.ReadToEnd();
lay.Layout = myStr;
#endregion
_dbRahat.Layouts.InsertOnSubmit(lay);
_dbRahat.SubmitChanges();
}
and load the layout using the following code:
var lay = _dbRahat.Layouts.First(l => l.Id.ToString() == cmbPreset.SelectedValue.ToString());
byte
[] byteArray = Encoding.UTF8.GetBytes(lay.Layout);
var stream =
new
MemoryStream(byteArray);
grid.LoadLayout(stream);
FillGrid();
The problem is that the grid colors (header cell colors, data cell colors) are not saved and loaded with SaveLayout() and LoadLayout() methods. How can I solve this problem?
Thank you