Date: 10/17/2007 10:31:13 AM
Thank you for contacting us. This behavior will be corrected for the upcoming release.
The issue you are experiencing is caused when items are added in a BeginUpdate / EndUpdate block. In your case that happens when the datasource is changed. For the time being, please, move the line:
radGridView1.DataSource = m_dataTable;
after the following line:
radGridView1.GridElement.EndUpdate();
If you have any additional questions, please do not hesitate to contact us.
Sincerely yours,
Evtim
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Date: 10/17/2007 9:54:37 AM
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");
}