Hi,
Im trying to build a combo box that will allow multiple selections. My issue is that when i build the checkboxes i can't get to bind text against each checkbox. it comes up empty. is this the correct way to achieve what i want ?
Thanks
<radc:RadComboBox runat="server" ID="RadComboBox1" HighlightTemplatedItems="true" >
<Items>
<radc:RadComboBoxItem Text="One" Value="1" />
<radc:RadComboBoxItem Text="Two" Value="2"/>
<radc:RadComboBoxItem Text="Three" Value="3"/>
</Items>
<ItemTemplate>
<asp:CheckBox runat="server" ID="CheckBox" Text=""/>
<span><%# DataBinder.Eval(Container, "Text") %></span>
</ItemTemplate>
</radc:RadComboBox>
Im trying to build a combo box that will allow multiple selections. My issue is that when i build the checkboxes i can't get to bind text against each checkbox. it comes up empty. is this the correct way to achieve what i want ?
Thanks
<radc:RadComboBox runat="server" ID="RadComboBox1" HighlightTemplatedItems="true" >
<Items>
<radc:RadComboBoxItem Text="One" Value="1" />
<radc:RadComboBoxItem Text="Two" Value="2"/>
<radc:RadComboBoxItem Text="Three" Value="3"/>
</Items>
<ItemTemplate>
<asp:CheckBox runat="server" ID="CheckBox" Text=""/>
<span><%# DataBinder.Eval(Container, "Text") %></span>
</ItemTemplate>
</radc:RadComboBox>
5 Answers, 1 is accepted
0
Hello nadeetha,
You need to call the DataBind() of the RadComboBox in your Page_Load event.
I hope this helps.
Best wishes,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You need to call the DataBind() of the RadComboBox in your Page_Load event.
| RadComboBox1.DataBind(); |
I hope this helps.
Best wishes,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Skywalker
Top achievements
Rank 1
answered on 04 Mar 2008, 07:58 PM
I was having the same problem with Databinding inside a Template. Calling the DataBind method on the RadComboBox instance in the OnLoad event of the page (or UserControl) works indeed. Is it also possible to use the new ASP.NET "Bind" syntax? I tried this:
<telerik:radcombobox id="myList" runat="server" skin="Telerik">
<itemtemplate>
<asp:label runat="server" id="itemText" text='<%#Bind("Text") %>'></asp:label>
</itemtemplate>
<items>
<telerik:radcomboboxitem Text="Item 1" />
<telerik:radcomboboxitem Text="Item 2" />
<telerik:radcomboboxitem Text="Item 3" />
</items>
</telerik:radcombobox>
But it's not working; all rendered <li> items are empty. Am I doing it wrong?
<telerik:radcombobox id="myList" runat="server" skin="Telerik">
<itemtemplate>
<asp:label runat="server" id="itemText" text='<%#Bind("Text") %>'></asp:label>
</itemtemplate>
<items>
<telerik:radcomboboxitem Text="Item 1" />
<telerik:radcomboboxitem Text="Item 2" />
<telerik:radcomboboxitem Text="Item 3" />
</items>
</telerik:radcombobox>
But it's not working; all rendered <li> items are empty. Am I doing it wrong?
0
Hello Sipke,
For the Prometheus controls you need to use DataBinder.Eval method.
This is described here: Controls > RadComboBox > Templates > Data Binding in Templates
I hope this helps.
Greetings,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
For the Prometheus controls you need to use DataBinder.Eval method.
This is described here: Controls > RadComboBox > Templates > Data Binding in Templates
I hope this helps.
Greetings,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Andrew
Top achievements
Rank 1
answered on 22 Oct 2008, 03:42 PM
Hi, is there a way to do this same databinding for a control that is created at runtime?
0
Hello Andrew,
You can create Templates at Runtime as well. Please check this article:
Adding Templates
Regards,
Veselin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can create Templates at Runtime as well. Please check this article:
Adding Templates
Regards,
Veselin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.