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

Radgrid with combo

2 Answers 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rock
Top achievements
Rank 1
rock asked on 24 Jul 2010, 11:40 AM
My question is i have one check box .and one rad grid with combo box.(with value .P for present,A for absent ,L for leave)
when i checked check box that time  each combo box of rad grid have selected value should be 'P'
so.. how i can change  selection of all combos of rad grid on check box changed event.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 26 Jul 2010, 05:40 AM
Hello,

Try the following code snippet in CheckBox1_CheckedChanged event to change the SelectedValue of RadComboBox in grid.

ASPX:
<telerik:GridTemplateColumn>
    <ItemTemplate>
        <telerik:RadComboBox ID="RadComboBox1" runat="server">
            <Items>
                <telerik:RadComboBoxItem Text="A" Value="A" />
                <telerik:RadComboBoxItem Text="P" Value="P" />
                <telerik:RadComboBoxItem Text="L" Value="L" />
            </Items>
        </telerik:RadComboBox>
    </ItemTemplate>
</telerik:GridTemplateColumn>

<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" />

C#:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
   {
      foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
       {
           RadComboBox combo = (RadComboBox)item.FindControl("RadComboBox1");
           combo.SelectedValue = "P";
       }
    }

Thanks,
Princy.
0
rock
Top achievements
Rank 1
answered on 26 Jul 2010, 10:48 AM
Thank u very much for quick reply.
i m applying this logic in my form
Tags
Grid
Asked by
rock
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
rock
Top achievements
Rank 1
Share this question
or