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

How to check a checkbox if item status is active

1 Answer 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cengiz
Top achievements
Rank 1
Cengiz asked on 24 Nov 2011, 04:35 PM
columns.Bound(o => o.Status).ClientTemplate("<input type='checkbox' name='Status' checked='<#= Status#>' value='<#= Status#>' onclick='checkboxClicked(\"<#= Id #>\")' />");


whether or not status is true or false it always checked. Why?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Nov 2011, 06:30 AM
Hello Cengiz,

I am not quite sure about your requirement. I suppose you want to know the status of input type CheckBox. Here is the sample code that I tried which worked as expected.
C#:
  protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
  if (e.Item is GridDataItem)
  {
      GridDataItem item = (GridDataItem)e.Item;
      HtmlInputCheckBox chk = (HtmlInputCheckBox)item.FindControl("Id");  
      if (chk.Checked==true)
       {
           //code here
        }
  }
}

-Princy.
Tags
Grid
Asked by
Cengiz
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or