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

Multiple ComboBox

4 Answers 19 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Lawrence
Top achievements
Rank 1
Lawrence asked on 15 May 2017, 01:30 AM

Hi,

I am creating a multiple ComboBox. RadComboBox1 for region and the other RadComboBox2 for product. Both controllers have a checkbox option. Sample data as per below;

RadComboBox1;
A
B
C

RadComboBox2;
1
2
3

What do I need are, when user choose Region [A,C] and product [1,2,3], the result would be [A1,A2,A3,C1,C2,C3]. Please help.

 

Thanks.

 

 

 

4 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 15 May 2017, 05:44 AM
Hi Lawrence,

If I understand the scenario properly you want to bind the second ComboBox depending on the value selected in the first one. If so, you can see how to implement this in the followind live demo:
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx

If this is not the case, please, elaborate a bit on the exact scenario you want to achieve so we can advice you further.

Regards,
Vessy
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Lawrence
Top achievements
Rank 1
answered on 15 May 2017, 07:18 AM

Hi ,

Referring to live demo given, the combo box is a single option. My case has a checkbox within the both controllers for multichoice.

ASPX Code:

<telerik:RadComboBox ID="rcbRegion" runat="server" CheckBoxes="True" EnableCheckAllItemsCheckBox="true"
                        DataSourceID="sds_getRegion" DataTextField="_REGION" DataValueField="_REGION">
                    </telerik:RadComboBox>
                    <telerik:RadComboBox ID="rcbProduct" runat="server" CheckBoxes="True" EnableCheckAllItemsCheckBox="true"
                        DataSourceID="sds_getProduct" DataTextField="_PRODUCT" DataValueField="_PRODUCT">
                    </telerik:RadComboBox>

 

May refer attached picture for UI view.

Thanks.

 

0
Lawrence
Top achievements
Rank 1
answered on 17 May 2017, 03:09 AM

Hi ,

Finally, I am able to manage the code and get the result as what I need.

Aspx :

<div class="form-group">
    <label>Region : </label>
    <telerik:RadComboBox ID="rcbRegion" runat="server" CheckBoxes="True" EnableCheckAllItemsCheckBox="true"
        DataSourceID="sds_getRegion" DataTextField="_REGION" DataValueField="_REGION">
    </telerik:RadComboBox>
</div>
<div class="form-group">
    <label>Product : </label>
    <telerik:RadComboBox ID="rcbProduct" runat="server" CheckBoxes="True" EnableCheckAllItemsCheckBox="true"
        DataSourceID="sds_getProduct" DataTextField="_PRODUCT" DataValueField="_PRODUCT" DropDownWidth="300px">
    </telerik:RadComboBox>
</div>

C#

protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string checkedRegion = string.Empty;
            string checkedProduct = string.Empty;
            string checkedText = string.Empty;
            foreach (RadComboBoxItem reg in rcbRegion.Items)
            {
                if (reg.Checked)
                {
                    checkedRegion = reg.Text;
                    foreach (RadComboBoxItem pro in rcbProduct.Items)
                    {
                        if (pro.Checked)
                        {
                            checkedProduct = pro.Text;
                            checkedText += checkedRegion + "-" + checkedProduct + ", ";
                        }
                    }
                }
                else { checkedRegion = "0"; }
            }
            lblGroupString.Text = checkedText.Trim().TrimEnd(',');
        }

 

Appreciate your response.

Thanks.
0
Vessy
Telerik team
answered on 18 May 2017, 07:44 AM
Hi,

Thank you for the update, Lawrence as well as for sharing your solution with our community. I am glad you manged to implement the target scenario.

Regards,
Vessy
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ComboBox
Asked by
Lawrence
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Lawrence
Top achievements
Rank 1
Share this question
or