void GrvUsers_RowFormatting(object sender, RowFormattingEventArgs e) | |
{ | |
e.RowElement.RowInfo.Cells["Disable"].Value = ((bool)(e.RowElement.RowInfo.DataBoundItem as User).Claims["Disable"]) ? "Disable" : "Enable"; | |
e.RowElement.RowInfo.Cells["Id"].Value = (e.RowElement.RowInfo.DataBoundItem as People).Claims["Id"]; | |
e.RowElement.DoubleClick += delegate(object sender1, EventArgs e1) | |
{ | |
_presenter.EditUserAccunt((e.RowElement.RowInfo.DataBoundItem as User).UserName); | |
}; | |
} |
I've had some code that binds a grid to a DataTable. Periodically the DataTable is rebuilt and fields are added or removed based on what is available from a query. I've distilled the crash to the following code. This used to work fine prior to upgrading to SP2. Is there somthing I am overlooking or is there a bug in the new RadGridView.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void radButton1_Click(object sender, EventArgs e)
{
radGridView1.GridElement.BeginUpdate();
radGridView1.DataSource = null;
radGridView1.MasterGridViewTemplate.Columns.Clear();
radGridView1.Rows.Clear();
// Rebuild DataTable and Grid based on changes
GridViewTextBoxColumn column1 = new GridViewTextBoxColumn("C1 Text");
column1.DataField = "C1 Text";
column1.Width = 90;
GridViewTextBoxColumn column2 = new GridViewTextBoxColumn("C2 Text");
column2.DataField = "C2 Text";
column2.Width = 130;
column2.DataType = typeof(DateTime);
radGridView1.MasterGridViewTemplate.Columns.Add(column1);
radGridView1.MasterGridViewTemplate.Columns.Add(column2);
/*
*..... Add other Fields to Table and Grid based on available Data.
*/
m_dataTable.Clear();
m_dataTable.Columns.Clear();
m_dataTable.Columns.Add("C1 Text", typeof(String));
m_dataTable.Columns.Add("C2 Text", typeof(DateTime));
radGridView1.DataSource = m_dataTable;
radGridView1.GridElement.EndUpdate();
radGridView1.Update();
}
DataTable m_dataTable = new DataTable("TheData");
}