I have a telerikgrid inside that i have a
<telerik:GridDropDownColumn DropDownControlType="RadComboBox" HeaderText="Expiration Units" DataField="qual_req_units"
OnItemDataBound and when it is in the edit mode i bind the combobox with the values.
OnItemCreated i tried to display the value from that is stored in the db.
GridDataItem item = (GridDataItem)e.Item;
DataRowView drv = (DataRowView)e.Item.DataItem;
item["qual_req_units"].Text = drv.Row["qual_req_units"].ToString();
Still it doesn't show any value in the view mode. In edit mode it shows the radcombo box's correctly. But even when select and update it doesn't show any value.
Please let me know what i need to do to display the value in the view mode.
12 Answers, 1 is accepted
Please check the following code snippet I tried to show the updated value in view mode.
Now i have a different issue. Whenever the grid id doing a postback the values of dropdown are again not displaying because it doesn't go to the itemdatabound and the View state is lost.
The postback that i refering is the grid selectedindexchanged. On this event also, i still want display the dropdown values.
TextChanged event occurs when the text in the input area of RadComboBox changes. This means that AllowCustomText must be set to true in order to be able to change the text in the combo input. Finally set AutoPostBack to true and subscribe for this event in the code behind:
I hope this helps.
the Telerik team
You can attach the RadComboBox SelectedIndexChanged event in the RadGrid_ItemCreated event as follows.
Princy provided you with the correct approach. Here is the code converted into VB.NET: To convert C# code to VB.NET code you can use Telerik's Code Converter.
the Telerik team
However, when the "ExpandCollapse" Item Command is fired the values displayed for my GridDropDownColumn set are empty.
How do I keep my displayed values?
One option is to try setting the GridDropDownColumn's DataField as DataKeyNames and access the DataKeyValue in the PreRender event of the RadGrid and set the text as follows.