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

Get the Value from Telerik:GridCheckBoxColumn

3 Answers 918 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siva
Top achievements
Rank 1
Siva asked on 03 Jun 2013, 09:42 AM
HI ,
        In my Radgrid i have a checkbox column , I binded it with the data

 

 

 

<telerik:GridCheckBoxColumn DataField="IsActive"

HeaderText="IsActive"

SortExpression="IsActive" UniqueName="chkIsActive">

 

</telerik:GridCheckBoxColumn>
In edit mode the check box is in edit mode , but getting the value from the particular checkboxcolumn is the problem.. Please help me to retreive the value from the checkbox on clicking update after editing. Thanks in advance..


I tried this but its not working
aspx.cs
----------

CheckBox

 

chkIsActive = (CheckBox)item.FindControl("chkIsActive");

if

 

(chkIsActive != null)

{

if (chkIsActive.Checked)

isActive =

"1";

else

isActive =

"0";

}
please help me with a code

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 03 Jun 2013, 10:19 AM
Hello,

Please try with the below code snippet.

foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
       {
           CheckBox chk = item["chkIsActive"].Controls[0] as CheckBox;
           // Now Acceess your checkbox here
       }


Thanks,
Jayesh Goyani
0
Shinu
Top achievements
Rank 2
answered on 03 Jun 2013, 12:01 PM
Hi Siva,

Please try the following code snippet.

C#:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem edit = (GridEditableItem)e.Item;
        CheckBox check = (CheckBox)edit["ColumnUniqueID"].Controls[0];
        //Your code goes here
    }
}

Thanks
Shinu
0
John
Top achievements
Rank 1
answered on 05 Mar 2015, 09:17 PM
Works great!  Thanks
Tags
Grid
Asked by
Siva
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
John
Top achievements
Rank 1
Share this question
or