GridView and coloring some rows

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
 
N

nahid

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
}
 
G

Guest

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
}
 
N

nahid

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top