Get the Value from Telerik:GridCheckBoxColumn

4 posts, 0 answers
  1. Siva
    Siva avatar
    35 posts
    Member since:
    Mar 2013

    Posted 03 Jun 2013 Link to this post

    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

  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 03 Jun 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jun 2013 Link to this post

    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
  5. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 05 Mar 2015 in reply to Jayesh Goyani Link to this post

    Works great!  Thanks
Back to Top