Well, I have seen similar problems and corresponding solutions on the forums, but none of those was applicable for this problem. I already have tried and searched almost any given solution on the forums here and around the internet, but unfortunately to no avail.
So, what exactly is the problem? I have got a RadComboBox which has an ObjectDataSource. This ComboBox has been placed in an EditItemTemplate within a RadListView. I want this RadComboBox to display the name of the currently selected customer as SelectedIndex (SelectedValue or Text). Items are filled based upon data out of an XmlDataSource object. The ObjectDataSource contains all possible customers.
Let's say I have inserted a new item with customer: "Customer1", but I'd like to edit this item. When you go into the EditItemTemplate view, I want to have the RadComboBox select (SelectedIndex/Value or Text) "Customer1" (which is based upon the XmlDataSource) from the ObjectDataSource.
My RadComboBox and ObjectDataSource look like:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AllowCustomText
=
"false"
DataSourceID
=
"ObjectDataSource1"
DataTextField
=
"Name"
DataValueField
=
"Name"
DropDownWidth
=
"128px"
EmptyMessage
=
"-Customer-"
EnableAutomaticLoadOnDemand
=
"true"
EnableVirtualScrolling
=
"true"
Filter
=
"Contains"
Height
=
"150px"
ItemsPerRequest
=
"10"
MarkFirstMatch
=
"true"
MinFilterLength
=
"2"
ShowMoreResultsBox
=
"true"
Width
=
"128px"
>
</
telerik:RadComboBox
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSource1"
runat
=
"server"
SelectMethod
=
"GetCustomers"
TypeName
=
"RadControlsWebApp1.Customers"
>
</
asp:ObjectDataSource
>
The XML file (XmlDataSource object) looks like:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
Activities
>
<
Activity
Customer
=
"Customer1"
Project
=
"Project1"
/>
<
Activity
Customer
=
"Customer1"
Project
=
"Project2"
/>
<
Activity
Customer
=
"Customer2"
Project
=
"Project2"
/>
<
Activity
Customer
=
"Customer3"
Project
=
"Project3"
/>
</
Activities
>
I have tried to set the Text property of the RadComboBox as follows: Text='<%# Bind("Customer") %>' and setting the RadComboBox.SelectedIndex or RadComboBox.SelectedValue properties programmatically, but as I already mentioned, without results. Perhaps I tried to set the properties in the wrong event(s).