Is there a way to get rowID and identify cell (column) values based on that whenever a checkbox template column is checked in Ultrawebgrid?
I don't want this to be done inside any webgrid event. I would like to loop through the rows to see the checkbox selected ones and then read the other column values based on that.
Thanks!
Hello,
Let me know if you have any questions with this matter.
Thanks.
Assume that you have declared the checkbox in the aspx. page like this:
<igtbl:TemplatedColumn Key="TemplateCheckBox">
<CellTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</CellTemplate>
</igtbl:TemplatedColumn>
You can loop through all grid rows first cast the column that has been declared as TemplatedColumn then check the CellItemes collection by index and invoke FindControl method which will return the checkbox associated with particular cell.
protected void Button2_Click(object sender, EventArgs e)
{
foreach (UltraGridRow row in UltraWebGrid1.Rows)
TemplatedColumn column = (TemplatedColumn)
UltraWebGrid1.Columns.FromKey("TemplateCheckBox");
CheckBox checkBox =
((CellItem)column.CellItems[row.Index]).FindControl("CheckBox1") as CheckBox;
if (checkBox.Checked)
//Do some stuff here
}
Hope this helps.