Hi
You can use the following approach to achieve this requirement:
C#:
Hope this helps. Please give it a try and let me know about the result.
Regards,
Eyup
Telerik
,You can use the following approach to achieve this requirement:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
OnDataBinding
=
"RadComboBox1_DataBinding"
></
telerik:RadComboBox
>
protected
void
RadComboBox1_DataBinding(
object
sender, EventArgs e)
{
RadComboBox combo = (RadComboBox)sender;
RadDataFormDataItem item = (RadDataFormDataItem)combo.NamingContainer;
// acceess unique item ID
string
customerID = item.GetDataKeyValue(
"CustomerID"
).ToString();
// apply combo settings
combo.DataTextField =
"TextField"
;
combo.DataValueField =
"ValueField"
;
// obtain and set the data source depending on the unique ID
var dummySource = Enumerable.Range(1, 6).Select(
x =>
new
{ ValueField = x, TextField =
"C: "
+ customerID +
", Book: "
+ x });
combo.DataSource = dummySource;
// select item if present
combo.DataBound += (s, a) =>
{
RadComboBoxItem comboItem = combo.FindItemByValue(
"3"
);
if
(comboItem !=
null
)
{
comboItem.Selected =
true
;
}
};
}
Hope this helps. Please give it a try and let me know about the result.
Regards,
Eyup
Telerik