GridView and coloring some rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i want in my GridView

to color in some colors background of the rows,when i have certin values in
the binded data.

how can i do this?



thnaks in advance

peleg
 
i want in my GridView

to color in some colors background of the rows,when i have certin values in
the binded data.

how can i do this?

thnaks in advance

peleg

hi try this hope help
private void DG_RowDataBound(object o, GridViewRowEventArgs e)
{
// apply custom formatting to data cells
if (e.Row.RowType == DataControlRowType.DataRow)
{
// set formatting for the category cell
TableCell cell = e.Row.Cells[0];
cell.BackColor = System.Drawing.Color.LightGray;
}

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd
}
 
i want to color all the row background not just a cell
how do i do it?
thnaks
peleg

nahid said:
i want in my GridView

to color in some colors background of the rows,when i have certin values in
the binded data.

how can i do this?

thnaks in advance

peleg

hi try this hope help
private void DG_RowDataBound(object o, GridViewRowEventArgs e)
{
// apply custom formatting to data cells
if (e.Row.RowType == DataControlRowType.DataRow)
{
// set formatting for the category cell
TableCell cell = e.Row.Cells[0];
cell.BackColor = System.Drawing.Color.LightGray;
}

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd
}
 
i want to color all the row background not just a cell
how do i do it?
thnaks
peleg



hi try this hope help
private void DG_RowDataBound(object o, GridViewRowEventArgs e)
{
// apply custom formatting to data cells
if (e.Row.RowType == DataControlRowType.DataRow)
{
// set formatting for the category cell
TableCell cell = e.Row.Cells[0];
cell.BackColor = System.Drawing.Color.LightGray;
}

- Show quoted text -

its simple try
private void DG_RowDataBound(object o, GridViewRowEventArgs e)
{
e.Row.BackColor = System.Drawing.Color.AliceBlue;
}

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd
 
Back
Top