how to detect grid view empty cell
Posted
by nCdy
on Stack Overflow
See other posts from Stack Overflow
or by nCdy
Published on 2010-04-08T07:33:57Z
Indexed on
2010/04/08
7:43 UTC
Read the original article
Hit count: 325
how to detect grid view empty cell ? I need it for highlighting. So I made a css
.RedColored
{
background: FF0000;
}
and trying to appear it to empty GV cells this way :
protected virtual GridView1_RowDataBound (_sender : object, e : System.Web.UI.WebControls.GridViewRowEventArgs) : void
{
e.Row.Cells[0].CssClass = "wide";
foreach(i : int in [0..e.Row.Cells.Count-1])
{
when(e.Row.Cells[i].Text==null)
{
e.Row.Cells[i].CssClass="RedColored";
}
}
}
but my it doesn't appears to empty cells , even I've tried Text=="" , Cell[i]==null, Cell[i].ToString()=="" and nothing helped.
© Stack Overflow or respective owner