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

Combox with Checkbox Inside a Radgrid

1 Answer 76 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Harikrishnan
Top achievements
Rank 1
Harikrishnan asked on 23 Apr 2013, 11:10 AM
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>

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 26 Apr 2013, 10:54 AM
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.
Tags
ComboBox
Asked by
Harikrishnan
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or