User1769015664 posted
My gridview display data as follows; how do I display 1, 2 and 3 only once the first time and blank for the next records? I used the following code but it removes the Type from every other row.
Type Value Misc
1 Course 1 aaa
1 Course 2 bbb
1 Course 3 ccc
2 Course 4 ddd
2 Course 5 eee
2 Course 6 fff
3 Course 7 ggg
string tempColumnValue = "";
foreach (GridViewRow row in GridView1.Rows)
{
if (string.Compare(row.Cells[0].Text, tempColumnValue, true) == 0)
{
row.Cells[0].Text = "";
}
else
{
tempColumnValue = row.Cells[0].Text;
}
}