Hi I have a gridcontrol, which includes three columns: column1, column2 and column 3. Column2 and Column3 are repository comboBox1 and repository comboBox2: repcomboBox 1 has a data source of string type list and repcomboBox2 has a data source of int type list.
My grid control also has a data source.
I hope to implement the following function: when stringA is selected in repcomboBox1, the value in repcomboBox2 will be default to intA.
I try the following code:
private void repoCombo1_EditValueChanged(object sender, EventArgs e)
{
GridView view = gridControl1.FocusedView as GridView;
string format = gridView1.GetFocusedRowCellValue("field2Name").ToString();
if (format.Equals(stringA))
{
gridView1.SetRowCellValue(gridView1.FocusedRowHandle, view.Columns.ColumnByFieldName("field3Name"), intA);
}
}
For example, if in rowX the current value in repcomboBox1 is stringB, I selected stringA instead of stringB, I debug into the code and find ” string format = gridView1.GetFocusedRowCellValue(“field2Name”).ToString();” set format as “stringB” other than “stringA” which I expect. How could I get the newly selected value in the repository comboBox? Why it doesn’t change? Thanks a lot!
You should use the following code for this purpose: