Hi,
I am adding a check box as a cell template in Ultragrid.
Here my Question is that , I need to checka checkbox when there is no value in one of my cells on the same row.
ex : If i have no value in " to date" filed then i need to check the check box else checked should be false.
if (grdOwner.Rows.Count > 0)
{
foreach (UltraGridRow row in grdOwner.Rows)
if (row.Cells[7].Text == null)// T0 date cell value else
row.Cells[0].Value = true; // trying to check the check box
}
row.Cells[0].Value = false;
i have the above code snippet. But if there is a value in to date field , then also its showing me unchecked.
Its remaing same, But its not checked at all.
Please help me on the same... Its urgent.
HBA,
I really appreciate u, Its working for me , Thank Alot
Regards,
Sreenivas
If you have the controls (checkbox in your case) inside the template column then you could not get its reference directly.
You need to get reference of control inside templete column using code.
Try following:
TemplatedColumn col = (TemplatedColumn)row.Cells[0].Column;
CellItem ci = (CellItem)col.CellItems[row.Index];
CheckBox chk1 = (CheckBox) ci.FindControl("ID_OF_CheckBox");
if (row.Cells[7].Text == null)
chk1.Checked = true;
else
chk1.Checked = false;
Please let me know if this helps you.