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

2 posts, 0 answers
  1. Jiten
    Jiten avatar
    57 posts
    Member since:
    Sep 2012

    Posted 16 Jul 2015 Link to this post

    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

  2. Aneliya Petkova
    Admin
    Aneliya Petkova avatar
    207 posts

    Posted 20 Jul 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top