This is a migrated thread and some comments may be shown as answers.

[Solved] radcombobox databinding

1 Answer 173 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Abiri Masoni
Top achievements
Rank 1
Abiri Masoni asked on 08 Jan 2010, 12:57 PM
Hello all!

i have the following rad controls on my page.

<

 

 

rad:RadTextBox ID="txtOtherNames" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OtherNames") %>'>

 

 

 

</rad:RadTextBox>

 

 

<

 

 

rad:RadComboBox ID="txtGender" runat="server" value='<%# DataBinder.Eval(Container, "DataItem.Gender") %>' >

 

 

 

<Items>

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem1" runat="server" Text="Male" Value="M" />

 

 

 

<rad:RadComboBoxItem ID="RadComboBoxItem2" runat="server" Text="Female" Value="F" />

 

 

 

</Items>

 

 

 

</rad:RadComboBox>

 

 

<

 

 

rad:RadDatePicker ID="txtDOB" runat="server" SelectedDate='<%# DataBinder.Eval(Container, "DataItem.Dob") %>'>

 

 

 

</rad:RadDatePicker>

 

 

 

<asp:RequiredFieldValidator ID="txtDOBValidator" runat="server" ControlToValidate="txtDOB"

 

 

 

Display="Dynamic" ErrorMessage="<div>Date expected</div>" />

 

<

 

 

rad:RadComboBox ID="txtGuardian" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.GuardianId") %>'>

 

 

 

</rad:RadComboBox>

 

The textbox and date picker work correctly ie. are binding but the comboboxes are not adjusting according to the records in the table.

What shld i use in the

='

 

 

<%# DataBinder.Eval(Container, "DataItem.GuardianId") %>' clause.

 

 

thnx so much

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 08 Jan 2010, 08:29 PM
Hello Abiri Masoni,

You should set the AllowCustomText property of the txtGuardian RadComboBox to true in order to make this work, because by default you cannot set the Text property to an arbitrary text unless there is an existing Item with the same text.

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Abiri Masoni
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or