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

get values from multicombobox

6 Answers 19 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
sarthkee
Top achievements
Rank 1
Veteran
sarthkee asked on 11 Feb 2021, 07:30 AM

I have a combobox working as multicolumncombobox, so I have to fetch all sub-items of selected item. how to fetch it?

I only found to fetch text and value...

regards,

sarthkee

6 Answers, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 15 Feb 2021, 03:59 PM

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/.

0
sarthkee
Top achievements
Rank 1
Veteran
answered on 16 Feb 2021, 07:47 AM

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.

0
Attila Antal
Telerik team
answered on 16 Feb 2021, 11:54 AM

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/.

0
sarthkee
Top achievements
Rank 1
Veteran
answered on 17 Feb 2021, 08:45 AM

Okay thanks,  Attila Antal. So i have to fetch data everytime from database.

 

0
Attila Antal
Telerik team
answered on 22 Feb 2021, 07:49 AM

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/.

0
sarthkee
Top achievements
Rank 1
Veteran
answered on 22 Feb 2021, 08:51 AM
Thanks :)
Tags
ComboBox
Asked by
sarthkee
Top achievements
Rank 1
Veteran
Answers by
Attila Antal
Telerik team
sarthkee
Top achievements
Rank 1
Veteran
Share this question
or