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

Radcombox checkbox Item selection in foreach loop not working when I use the OnItemsRequested event

1 Answer 616 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jiten
Top achievements
Rank 1
Jiten asked on 16 Jul 2015, 06:11 PM

Hello,

I use the OnItemsRequested event  to get the data from database:

Below are design code:

<telerik:RadComboBox ID="ddlItem" runat="server" Width="45%" ZIndex="50000" Height="400px"
                                                DropDownWidth="500px" HighlightTemplatedItems="true" EmptyMessage="[ Search items by typing minimum 2 characters ]"
                                                AllowCustomText="true" MarkFirstMatch="true"  EnableLoadOnDemand="true" OnItemsRequested="ddlItem_OnItemsRequested"
                                                Skin="Office2007" ShowMoreResultsBox="true" EnableVirtualScrolling="true" OnClientItemsRequesting="OnClientItemsRequesting"
                                                CheckBoxes="true" >
                                                <HeaderTemplate>
                                                    <table style="width: 100%" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td style="width: 10%" align="left">
                                                                <asp:Literal ID="Literal1" runat="server" Text="Group"></asp:Literal>
                                                            </td>
                                                            <td style="width: 60%" align="left">
                                                                <asp:Literal ID="Literal2" runat="server" Text="Item Name"></asp:Literal>
                                                            </td>
                                                            <td style="width: 15%" align="right">
                                                                Stock
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <table style="width: 100%" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td style="width: 10%" align="left">
                                                                <%# DataBinder.Eval(Container,"Attributes['ItemSubCategoryShortName']" )%>
                                                            </td>
                                                            <td style="width: 60%" align="left">
                                                                <%# DataBinder.Eval(Container, "Text")%>
                                                            </td>
                                                            <td style="width: 15%" align="right">
                                                                <%# DataBinder.Eval(Container, "Attributes['ClosingBalance']")%>
                                                            </td>
                                                            <td style="width: 10%; display: none;" align="right">
                                                                <%# DataBinder.Eval(Container, "Attributes['Percentage']")%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </ItemTemplate>
                                            </telerik:RadComboBox>​

And i use the following code in c#:

 protected void ddlItem_OnItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
    {

//write login code to get the data from database through ItemRequest event.

}

 

What I want is I use the checkbox to select multiple items or data from drop down and add all the checkboxs true to grid but when i use foreach loop then I can't get the checkbox true items.

Here is the code:

 

 foreach (RadComboBoxItem ComboItem in ddlItem.CheckedItems)
        {
            if (ComboItem.Checked == true)
            {
            }       
}

The above loop is not working when i try to get the checked true items.

 Please help me as soon as possible.

I hope you understand my query.

 

Thanks

Jiten Mutum

1 Answer, 1 is accepted

Sort by
0
Aneliya Petkova
Telerik team
answered on 20 Jul 2015, 08:37 AM
Hello Jiten,

Could you please specify where exactly you add the foreach loop to iterate through checked items in the RadComboBox(in which event)? It would be very helpful if you provide a sample runnable project demonstrating your scenario(it could be very simple only with RadComboBox filled with dummy data).

Regards,
Aneliya Petkova
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Jiten
Top achievements
Rank 1
Answers by
Aneliya Petkova
Telerik team
Share this question
or