gridview

gridview

am 31.12.2007 11:38:52 von Roger

Hi All

hope you can help here

Is it possiable to change the colour of a row in a gridview depending on the
content of one cell ?

Hope that makes sense

Happy New year to all

Roger

Re: gridview

am 31.12.2007 14:02:14 von Eliyahu Goldin

You can do it in either RowDataBound or PreRender event:

protected void allGrids_OnRowDataBound(Object sender,
System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
System.Web.UI.WebControls.TableCell cell =
e.Row.Cells[myIndex];
if (check something for cell)
{
e.Row.(set properties as needed)
}
}
}


--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Roger" wrote in message
news:384E8CFC-1CDA-4836-8D61-CBCD9FC70034@microsoft.com...
> Hi All
>
> hope you can help here
>
> Is it possiable to change the colour of a row in a gridview depending on
> the content of one cell ?
>
> Hope that makes sense
>
> Happy New year to all
>
> Roger

Re: gridview

am 31.12.2007 14:03:04 von xyz_john

Theres an example here

http://msdn2.microsoft.com/en-us/library/aa479342.aspx

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog


"Roger" wrote in message
news:384E8CFC-1CDA-4836-8D61-CBCD9FC70034@microsoft.com...
> Hi All
>
> hope you can help here
>
> Is it possiable to change the colour of a row in a gridview depending on
> the content of one cell ?
>
> Hope that makes sense
>
> Happy New year to all
>
> Roger