I have a Telerik RADGrid with a GridCheckBoxColumn I want to entire row background color to be green if the checkbox value is true. as my first step I was trying to get the value of the checkbox column using the code below.
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
{
CheckBox chkbox = item.FindControl("chkPriority") as CheckBox;
if (chkbox != null && chkbox.Checked)
{
string id_ = item["p_id"].Text;
}
}
}
But this code does not find any of the rows, the value for CheckBox is always null. How can I get those values
I have modified my code and I am now able to get the value of the check box. I can still not figure out how to set the back color of the cell or row. here is the modified code.
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
{
CheckBox chkbox = item["chkPriority"].Controls[0] as CheckBox;
if (chkbox.Checked == true)
{
GridDataItem dataItem = e.Item as GridDataItem;
}
}
}
question from:
https://stackoverflow.com/questions/65832430/using-c-sharp-how-can-i-get-the-value-from-a-telerik-gridcheckboxcolumn 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…