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

Catch value not in list in GridDropDownColumn

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 10 Sep 2012, 09:09 AM
In a RadComboBox I can override the PerformSelect() method to catch the exception when a value to be selected is not in the list.
In a GridDropDownColumn I can't override this method as it doesn't exist. All I could do is call GetTextFromInnerList and if the returned value is an empty string, I know that the value does not exist and I could manage that.

I can I deal with the following:

I have a databound grid. Some DropdownColumns reference a lookup list, e.g. Colors:
  • Green
  • Yellow
  • Blue

Now my databound datasource for the column contains "Blue", hence blue is selected. So far so good. Now someone changes the naming of colors and I have "BlueXXX" instead of Blue in my values for the dropdown column. The databound value for the column remains at Blue.

The dropdown column now only displays an empty string instead of the value from the database: "Blue" (even though "Blue" doesn't exist anymore in the datasource).

How can I e.g. Display the value "Blue" when in View mode and in Edit mode return an error - or don't allow to save the custom value "Blue" as it is not a valid selection anymore (BlueXXX would be valid now).

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 13 Sep 2012, 12:26 PM
Hi Dennis,

RadComboBox is also a databound control and the GridDropDownColumn allows to bind the combo to an underlying data source by specifying its DataSourceID, DataTextField and DataValueField. Could you paste your mark-up for the grid drop down column?

Greetings,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or