How do I change the colour of the grid in a GridView.

G

Guest

The GridLines property is set to Both and, in any case, I can see them if I
make the background anything other than white. But I really want the
backgroud white! Will I have to be content with not seeing the grid lines? Or
is there a property that I can't see?
 
Y

Yuan Ren[MSFT]

Hi,

Thanks for posting!

If you don't want to see the GridLines, why not set the property to "None"?

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
G

Guest

I'm sorry but you missunderstand. I DO want to display the GridLines but I
also want the background colour to be white so clearly the GridLines will
have to be another colour - Grey probably - but I can't find a property to
change the GridLineColour! Is there one?
 
C

Christopher Reed

Using the ItemStyle and HeaderStyle properties, you can set the BorderColor
equal to your color of choice. This will only affect the GridLines and not
the border of the table itself.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

Dick said:
I'm sorry but you missunderstand. I DO want to display the GridLines but I
also want the background colour to be white so clearly the GridLines will
have to be another colour - Grey probably - but I can't find a property to
change the GridLineColour! Is there one?

"Yuan Ren[MSFT]" said:
Hi,

Thanks for posting!

If you don't want to see the GridLines, why not set the property to
"None"?

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 
Y

Yuan Ren[MSFT]

Hi Richard,

Thanks for your reply!

I'm sorry for misunderstanding the issue. After my researching, if you want
to change the color of the cell border in the GridView control, I suggest
you use the CSS to do. We can use the RowDataBound event to set the color
for the control. Below code demonstrates how to do:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (TableCell tc in e.Row.Cells)
{
tc.Attributes["style"] = "border-color:red";
}
}

I hope the above information will be helpful. If you have any issues or
concerns, please let me know. It's my pleasure to be of assistance

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
 

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,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top