To reproduce:
public Form1()
{
InitializeComponent();
List<Item> items = new List<Item>();
for (int i = 1; i <= 10; i++)
{
items.Add(new Item(i, "Product" + i, 0.25m * i, i));
}
this.radGridView1.DataSource = items;
GridViewDecimalColumn col = new GridViewDecimalColumn("Calculated Column");
col.Expression = "Quantity*Price/100";
this.radGridView1.Columns.Add(col);
this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
}
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
public Item(int id, string name, decimal price, int quantity)
{
this.Id = id;
this.Name = name;
this.Price = price;
this.Quantity = quantity;
}
}
MemoryStream s = new MemoryStream();
private void radButton1_Click(object sender, EventArgs e)
{
s = new MemoryStream();
this.radGridView1.SaveLayout(s);
}
private void radButton2_Click(object sender, EventArgs e)
{
this.radGridView1.LoadLayout(s);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
s.Close();
}
Workaround: before loading the layout, clear the columns