Combox with Checkbox Inside a Radgrid

2 posts, 0 answers
  1. Harikrishnan
    Harikrishnan avatar
    21 posts
    Member since:
    Jul 2012

    Posted 23 Apr 2013 Link to this post

    How can we find the checked items/values in a combobox(cmobx having checkbox ) and this combobos is located in rad grid..S
    ee the attached image and code

    <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" ShowStatusBar="true" AutoGenerateColumns="true"
                                PageSize="10" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True"
                                OnNeedDataSource="RadGrid1_NeedDataSource" Skin="MyCustomSkin" EnableEmbeddedSkins="false"
                                OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated">
                                <PagerStyle Mode="NumericPages"></PagerStyle>
                                <MasterTableView AutoGenerateColumns="false">
                                    <Columns>
      <telerik:GridTemplateColumn HeaderText="Indian Affairs Benefits" ItemStyle-Width="90px"
                                            UniqueName="IndianAffairsBenefits">
                                            <ItemTemplate>
                                                 
                                                 
                                                    <telerik:RadComboBox Skin="Inox" ID="ddOnelChild" runat="server" EnableEmbeddedSkins="False"
                                                        MarkFirstMatch="True" Width="120px" Visible="false">
                                                    </telerik:RadComboBox>
                                                    <telerik:RadComboBox Visible="false" Skin="Inox" ID="ddlMeAndSelectedChildren" runat="server"
                                                        EnableEmbeddedSkins="False" MarkFirstMatch="True" Width="120px">
                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="chkbx" Checked="true" runat="server"  />
                                                            <asp:Label runat="server" ID="lblItem" AssociatedControlID="chkbx">
                                                            <%# Eval("Namess") %>
                                                            </asp:Label>
                                                        </ItemTemplate>
                                                        <CollapseAnimation Type="OutQuint" Duration="200" />
                                                    </telerik:RadComboBox>
                                                 
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
  2. Plamen
    Admin
    Plamen avatar
    2969 posts

    Posted 26 Apr 2013 Link to this post

    Hi ,

     
    Here is the code that helped me receive the count of the checked items in a Combobox similar you the one you shared:

    <Columns>
                          <telerik:GridTemplateColumn HeaderText="Indian Affairs Benefits" ItemStyle-Width="90px"
                              UniqueName="IndianAffairsBenefits">
                              <ItemTemplate>
     
     
                                  <telerik:RadComboBox ID="RadComboBox1" runat="server" CheckBoxes="true"
                                      EnableEmbeddedSkins="False" MarkFirstMatch="True" Width="120px">
                                      <Items>
                                          <telerik:RadComboBoxItem Text="sdasda" />
                                      </Items>
                                  </telerik:RadComboBox>
     
     
                              </ItemTemplate>
                          </telerik:GridTemplateColumn>
    protected void RadButton1_Click(object sender, EventArgs e)
       {
         RadComboBox a=(RadComboBox)RadGrid1.MasterTableView.Controls[0].Controls[2].Controls[0].FindControl("RadComboBox1");
         Response.Write(a.CheckedItems.Count);
       }

    In this code I have use the internal Checkbox support of RadComboBox.

    Hope this will be helpful.

    Greetings,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top