This is a migrated thread and some comments may be shown as answers.

Get ComboBox value on RowValidated

1 Answer 40 Views
This is a migrated thread and some comments may be shown as answers.
Thomas Van den Bossche
Top achievements
Rank 1
Thomas Van den Bossche asked on 05 Nov 2009, 09:53 AM
Dear Madam/Sir,

One column of my GridView is a GridViewComboBoxColumn.
GridViewComboBoxColumn companyClmn = new GridViewComboBoxColumn( COLUMN_COMPANY ); 
companyClmn.DataSource = this.transport.GetCompanies( this.username ); 
companyClmn.DisplayMember = "companyName"
companyClmn.FieldName = "companyID"
companyClmn.Width = 150; 

I've added an event for RowValidated and want to check the value for this ComboBoxColumn
but I always get "Object reference not set...".
If I use a TextBoxColumn, I get the value without any problems.

private void SaveToDatabase( object sender, RowValidatedEventArgs e ) { 
    object value = e.Row.Cells[0].Value; // object reference not set...

Thanks in advance!

Edit: I've set .FieldName wrong... stupid error! Sorry!

1 Answer, 1 is accepted

Sort by
Martin Vasilev
Telerik team
answered on 10 Nov 2009, 02:58 PM
Hi Thomas Van den Bossche,

Thank you for writing.

I have tested a similar scenario like the described and I have not experienced any issues when getting the ComoBoxColumn value. I am using the latest release Q3 2009 and the following code works as expected:

void radGridView1_RowValidated(object sender, RowValidatedEventArgs e)
    var value = e.Row.Cells["MyComboColumn"].Value;

Please, try this code with the latest release and let me know if you still experience any issues.

All the best,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Asked by
Thomas Van den Bossche
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question