Monday, March 1, 2010

ASP.NET - modify content of GridView

Below is an example which modify content of a cell of GridView, after data binding:

{
............. // do data binding

int count = GridView_Result1.Rows.Count;
if (count > 0)
{
iCnt = 0;
foreach (GridViewRow row in GridView_Result1.Rows)
{
if (row.Cells[7].Text.Length > 10)
{
iCnt++;
strTemp = row.Cells[7].Text;
row.Cells[7].Text = "View";
}
}
}
....
}

No comments: