6 Answers, 1 is accepted
Hi Sarthkee,
In RadComboBox with Multi-Columns, you define the Colums in the Template, see Multi-column ComboBox
In the following examples, the ContactName, City and ContactTile fields will be displayed.
<ItemTemplate>
<ul>
<li class="col1">
<%# DataBinder.Eval(Container.DataItem, "ContactName") %></li>
<li class="col2">
<%# DataBinder.Eval(Container.DataItem, "City") %></li>
<li class="col3">
<%# DataBinder.Eval(Container.DataItem, "ContactTitle") %></li>
</ul>
</ItemTemplate>
In order to be able to display multiple fields, you will need to make sure the DataSource of the ComboBox does actually contain those fields.
<asp:SqlDataSource ID="SessionDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT Field1, Field2, Field3 FROM [Table]"></asp:SqlDataSource>
Once you have all the fields, you can then display them in the ComboBox:
<ItemTemplate>
<ul>
<li class="col1">
<%# DataBinder.Eval(Container.DataItem, "Field1") %></li>
<li class="col2">
<%# DataBinder.Eval(Container.DataItem, "Field2") %></li>
<li class="col3">
<%# DataBinder.Eval(Container.DataItem, "Field3") %></li>
</ul>
</ItemTemplate>Regards,
Attila Antal
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
I did this. But i want to fetch selected item's subitems from server side.
for eg: i have selected contactName='sarthkee'
so i want its city, ContactTitle.
Hi Sarthkee,
By the statement "But i want to fetch selected item's subitems from server side." did you mean that you want to fetch the database when you select an item in the ComboBox?
If the ComboBox is bound on the server you can use the SelectedIndexChanged event, and in the server side access the Current value and use that to fetch the corresponding data from the database.
If the ComboBox is bound on the Client-Side, you will need to use the Client-Side event "OnSelect" and send WebService request to the server to fetch more data from the database. See Events Overview article for more information.
Regards,
Attila Antal
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Okay thanks, Attila Antal. So i have to fetch data everytime from database.
Hi sarthkee,
If you want to have access to multiple fields at the time binding data to the ComboBox, you must bind multiple fields like I showed you earlier.
In case you would like to access some fields upon selecting an item, you must first select an item, and using the SelectedIndexChanged event, based on the selection you can query the database for more.
Regards,
Attila Antal
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
