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

use checkbox to fire itemcommand event

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Angie
Top achievements
Rank 1
Angie asked on 02 Oct 2008, 08:12 PM
I am using a RadGrid to display a list of checkbox items, upon checking an item, I would like to open that row for editing.  What is the best way to accomplish this?  Thanks.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 03 Oct 2008, 04:09 AM
Hi Angie,

You can use a GridTemplateColumn with a CheckBox in its ItemTemplate to achieve the desired scenario.

ASPX:
  <telerik:GridTemplateColumn UniqueName="TempCol" DataField="TimeSpan"  > 
                      <ItemTemplate> 
                            <asp:CheckBox ID="CheckBox2"   AutoPostBack="true"   runat="server" OnCheckedChanged="CheckBox2_CheckedChanged" /> 
                      </ItemTemplate> 
                    </telerik:GridTemplateColumn> 

CS:
protected void CheckBox2_CheckedChanged(object sender, EventArgs e) 
    { 
        CheckBox chkbx = (CheckBox)sender; 
        GridDataItem item = (GridDataItem)chkbx.NamingContainer; 
        item.Edit = chkbx.Checked; 
        
    } 

Thanks
Shinu.

Tags
Grid
Asked by
Angie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or