What I am trying to do is add a new row to a grid and then automatically set it to edit mode. What i'm finding is this fails on the first row that is inserted, but for every other row it works fine. I have tried setting current row/column a few different ways and found the same behaviour. Have set up a basic example of it below.
What happens is the first row will get inserted without being in edit mode. if you click the button every other row works correctly.
Is there anything that i'm doing wrong in this case?
Version i'm using is: Q2 2009 SP1.
Have attached an image of the result. http://bayimg.com/image/maefbaaco.jpg
private void Form1_Load(object sender, EventArgs e) |
{ |
radGridView1.MasterGridViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; |
radGridView1.ShowGroupPanel = false; |
radGridView1.MasterGridViewTemplate.EnableGrouping = false; |
radGridView1.MasterGridViewTemplate.AllowAddNewRow = false; |
GridViewComboBoxColumn col1 = new GridViewComboBoxColumn("Test1", "Test1"); |
col1.DropDownStyle = RadDropDownStyle.DropDownList; |
col1.FieldName = "Test1"; |
col1.DisplayMember = "Test1"; |
col1.DataType = typeof (int); |
col1.DataSource = new[] {1, 2, 3}; |
col1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; |
radGridView1.Columns.Add(col1); |
} |
private void button1_Click(object sender, EventArgs e) |
{ |
int rowCount = radGridView1.Rows.Count; |
object[] values = {1}; |
radGridView1.Rows.Add(values); |
radGridView1.MasterGridViewInfo.CurrentRow = radGridView1.Rows[rowCount]; |
radGridView1.Rows[rowCount].Cells["Test1"].BeginEdit(); |
} |
What happens is the first row will get inserted without being in edit mode. if you click the button every other row works correctly.
Is there anything that i'm doing wrong in this case?
Version i'm using is: Q2 2009 SP1.
Have attached an image of the result. http://bayimg.com/image/maefbaaco.jpg