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

Discussion in 'ASP .Net' started by =?Utf-8?B?RGljaw==?=, Jan 19, 2006.

  1. 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?
    =?Utf-8?B?RGljaw==?=, Jan 19, 2006
    #1
    1. Advertising

  2. 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
    Yuan Ren[MSFT], Jan 19, 2006
    #2
    1. Advertising

  3. 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]"" wrote:

    > 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
    >
    >
    =?Utf-8?B?RGljaw==?=, Jan 20, 2006
    #3
  4. 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" <> wrote in message
    news:...
    > 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]"" wrote:
    >
    >> 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
    >>
    >>
    Christopher Reed, Jan 21, 2006
    #4
  5. 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
    Yuan Ren[MSFT], Jan 23, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Doe

    Set the background colour of a grid

    John Doe, Oct 21, 2003, in forum: ASP .Net
    Replies:
    7
    Views:
    355
    Alvin Bruney
    Oct 22, 2003
  2. JezB
    Replies:
    9
    Views:
    349
    Curt_C [MVP]
    Apr 30, 2004
  3. Bazza Formez
    Replies:
    9
    Views:
    473
    Bazza Formez
    Dec 9, 2004
  4. Blindsya

    Table Cell Colour Change

    Blindsya, Sep 17, 2003, in forum: HTML
    Replies:
    1
    Views:
    2,112
    David Dorward
    Sep 17, 2003
  5. jodleren
    Replies:
    2
    Views:
    186
    Thomas 'PointedEars' Lahn
    Jan 12, 2008
Loading...

Share This Page