Hello Everyone,
I have a gridview, with both BoundField and TemplateField, both displaying values from a DataTable.
When I try the following code on OnRowDataBound property it works fine
foreach (TableCell cell in e.Row.Cells)
{
if (e.Row.Cells.GetCellIndex(cell) == 1 && e.Row.DataItemIndex > 0)
{
strCellVal = strCellVal + cell.Text.Trim();
//Response.Write(strCellVal);
}
}
The above code works fine when I GetCellIndex is set to BoundField.
But If i try to check with TemplateField it doesnt work.
I hope my question was clear.
Has anyone faced the same issue? Or know a workaround? Any suggestion would greatly appreciated.
Thanks!
I have a gridview, with both BoundField and TemplateField, both displaying values from a DataTable.
When I try the following code on OnRowDataBound property it works fine
foreach (TableCell cell in e.Row.Cells)
{
if (e.Row.Cells.GetCellIndex(cell) == 1 && e.Row.DataItemIndex > 0)
{
strCellVal = strCellVal + cell.Text.Trim();
//Response.Write(strCellVal);
}
}
The above code works fine when I GetCellIndex is set to BoundField.
But If i try to check with TemplateField it doesnt work.
I hope my question was clear.
Has anyone faced the same issue? Or know a workaround? Any suggestion would greatly appreciated.
Thanks!