Hi there, I'm building a web site and i want to paint/highlight the line that i m reading. here is my code:
foreach (GridViewRow rw in gvHastalar.Rows)
{
rw.CssClass = "gvKontrolEdilenSatir";
}
Thanks in advance
Hi there, I'm building a web site and i want to paint/highlight the line that i m reading. here is my code:
foreach (GridViewRow rw in gvHastalar.Rows)
{
rw.CssClass = "gvKontrolEdilenSatir";
}
Thanks in advance
If you have a particular row selected in the GridView you can compare the index of the current row in the foreach loop with the SelectedIndex
of the GridView. You can then conditionally set the CSS class if they match.
foreach (GridViewRow rw in gvHastalar.Rows)
{
if (rw.RowIndex == gvHastalar.SelectedIndex)
rw.CssClass = "SelectedCssClass";
else
rw.CssClass = "NotSelectedCssClass";
}