I have a radgrid that displays product information. One of the product information is Product Group. In EditForm, I have a RadComboBox that will enable the user to change the Product Group for the product. The RadComboBox will lists all available Product Groups (sorted in ascending).
For example:
I have a product Z that is currently a member of Product Group B. There are 3 Product Groups available, namely A, B and C. Currently, when I open the EditForm for product Z, the item that is displayed as the default product group on the RadComboBox is Product Group A. I want the combobox to display the default product group based on the product's current product group, in this case Product Group B.
I tried to follow this guide (http://www.telerik.com/help/aspnet-ajax/combobox-insert-default-item-when-databinding.html), but when the RadComboBox DataBound event is fired, I don't have the information on which product calls for it, hence I cannot make it display the correct product group name.
Currently I put the code for inside RadGrid
Please help.
Thanks.
For example:
I have a product Z that is currently a member of Product Group B. There are 3 Product Groups available, namely A, B and C. Currently, when I open the EditForm for product Z, the item that is displayed as the default product group on the RadComboBox is Product Group A. I want the combobox to display the default product group based on the product's current product group, in this case Product Group B.
I tried to follow this guide (http://www.telerik.com/help/aspnet-ajax/combobox-insert-default-item-when-databinding.html), but when the RadComboBox DataBound event is fired, I don't have the information on which product calls for it, hence I cannot make it display the correct product group name.
Currently I put the code for inside RadGrid
ItemDataBound event. I get the default product group to be displayed accordingly but it creates a duplicate and I don't think this is the correct way to do this.protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e){ if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditFormItem item = e.Item as GridEditFormItem; RadComboBox statusComboBox = (RadComboBox)item.FindControl("RadComboBox1"); // get the parent GridDataItem for this form // (i.e. which row this edit form is generated for) GridDataItem parentGridItem; parentGridItem = item.ParentItem; // put the current product group on combobox's first entry statusComboBox.Items.Insert(0, new RadComboBoxItem(parentGridItem["product_group"].Text, string.Empty)); }}Please help.
Thanks.