For our solution, we need to present a number of dynamic dropdowns with descriptive text choices but show only the simple Id key when the choice has been made. To achieve this today I have provided a simple example code snippet from a test.aspx file showing the basics of how we are achieving this.
So if someone picks the "5 - Complex Display Detail" it will fill in the RadComboBox with 5. For me, that is straight forward and functions as expected.
The problem comes in if we want to now use the CheckBoxes="true" feature added to the latest release. In this case it will not render properly due to the ItemTemplate. So I have one of two choices:
A good real world example would be to list the states by name but when you pick the state only have the 2 letter abbreviation show for the text to be submitted on the request (ie. pick Minnesota from the list of choices but have MN appear as the text for the RadComboBox request text).
Thanks,
Shane
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<%
System.Collections.Generic.List<
RadComboBoxItem
> choices = new System.Collections.Generic.List<
RadComboBoxItem
>();
for(int i=1; i <= 10; i++)
{ choices.Add(new RadComboBoxItem("" + i + "- Complex Display Detail", "" + i));
}
RadComboBox1.DataSource = choices;
RadComboBox1.DataBind();
%>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AllowCustomText
=
"true"
DataTextField
=
"Value"
DataValueField
=
"Value"
Width
=
"333px"
CheckBoxes
=
"false"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
><%# Eval("Text") %></
asp:Label
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
The problem comes in if we want to now use the CheckBoxes="true" feature added to the latest release. In this case it will not render properly due to the ItemTemplate. So I have one of two choices:
- Figure out a way to have the checkboxes render as part of my customized template with similar results showing complex choices but simple display on selection.
- I need an alternate way to show Complex choices but have the actual choice showing on the RadComboBox as the code and not the complex choice description.
A good real world example would be to list the states by name but when you pick the state only have the 2 letter abbreviation show for the text to be submitted on the request (ie. pick Minnesota from the list of choices but have MN appear as the text for the RadComboBox request text).
Thanks,
Shane