I was having an issue getting the SelectedValue from the telerik RadComboBox control in a rad grid. Here is how you do it:
The front End code:
<telerik:GridDropDownColumn DataSourceID="DSCategories" ListTextField="CategoryName" ListValueField="CategoryID"
UniqueName="CategoryDD" SortExpression="CategoryName" HeaderText="Category" DataField="CategoryID"
DropDownControlType="RadComboBox" FooterText="RadComboBox column footer"
AllowAutomaticLoadOnDemand="true" AllowVirtualScrolling="true" ShowMoreResultsBox="true"
ItemsPerRequest="10">
</telerik:GridDropDownColumn>
The Backend Code:
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
GridEditFormInsertItem insertItem = e.Item as GridEditFormInsertItem;
RadComboBox DDCat = (insertItem["CategoryDD"].Controls[0] as RadComboBox);
int DDcategory = Convert.ToInt16(DDCat.SelectedValue);
}
James,
ReplyDeleteThanks a lot for sharing. This post saved me a lot of time. I appreciate your help very much. This really is a wonderful world.
Very glad I could help, the whole reason I post anything on his blog is for exactly that, to help save someone else the time and pass on the knowledge.
ReplyDeleteThank you,
James Campbell
MCP,MCSA,MCSE,Security +
tel - five seven zero - 223 - 8452