DataGrid Border around earch row

Discussion in 'ASP .Net' started by =?Utf-8?B?QWxleCBNYWdoZW4=?=, Jun 12, 2006.

  1. I'd like there to be a border around each row of my data-grid but NOT between
    the columns. I've tried setting

    BorderColor="Black"
    BorderStyle="Solid"
    BorderWidth="1px"
    ItemStyle-BorderColor="Black"
    ItemStyle-BorderStyle="Solid"
    ItemStyle-BorderWidth="1px"

    at the top of the DataGrid element but, for some reason, these have no
    effect. Ideas?

    Alex
     
    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Jun 12, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    Winista Guest

    You can set the GridLines property to Horizontal instead of "Both"


    "Alex Maghen" <> wrote in message
    news:...
    > I'd like there to be a border around each row of my data-grid but NOT
    > between
    > the columns. I've tried setting
    >
    > BorderColor="Black"
    > BorderStyle="Solid"
    > BorderWidth="1px"
    > ItemStyle-BorderColor="Black"
    > ItemStyle-BorderStyle="Solid"
    > ItemStyle-BorderWidth="1px"
    >
    > at the top of the DataGrid element but, for some reason, these have no
    > effect. Ideas?
    >
    > Alex
    >
     
    Winista, Jun 12, 2006
    #2
    1. Advertising

  3. Thanks for Winista's good suggestion.

    Hi Alex,

    You can use the "GridLines" property Winista has mentioned to set the
    DataGrid(or GridView)'s gridline style, it support none, both, horizental,
    vertical ... And actually this property is implemented through the html
    <table> element's "rules" attribute (you can also utilize it when you use
    pure html <table>):

    #11.3.1 Borders and rules
    http://www.w3.org/TR/html4/struct/tables.html#h-11.3.1

    BTW, if you also want to apply some style onto the gridview/datagrid's
    gridline, you'll need to use css style class and gridline's style is not
    controlled by the gridview/datagrid(html table)'s border setting. Here is
    a simple DataGrid which display only horizental gridlines and set its
    gridlines and border color to "red":

    ========datagrid =========
    </div>
    <asp:DataGrid ID="DataGrid1" runat="server"
    DataSourceID="SqlDataSource1"
    GridLines="Horizontal" CssClass="Grid">
    </asp:DataGrid>
    </form>

    ======css style==========
    .Grid
    {
    border-style:solid;
    border-width: 2px;
    border-bottom-color:Red;
    border-top-color: Red;
    border-left-color:red;
    border-right-color:red;


    }


    .Grid th
    {

    border-width: 2px;
    border-bottom-color:Red;
    border-top-color: Red;
    border-left-color:red;
    border-right-color:red

    }

    .Grid td
    {
    border-width: 2px;
    border-bottom-color:Red;
    border-top-color: Red;
    border-left-color:red;
    border-right-color:red

    }
    =========================

    Hope this also helps.

    Regards,

    Steven Cheng
    Microsoft MSDN Online Support Lead


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Jun 13, 2006
    #3
  4. Hey Alex,

    Does the info in my last reply also help some? If there is still anything
    we can help, please don't hesitate to post here.

    Regards,

    Steven Cheng
    Microsoft MSDN Online Support Lead


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Jun 14, 2006
    #4
  5. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    suma

    Joined:
    Jun 1, 2007
    Messages:
    2
    Hello Steven,
    Thank you very much. Your suggestion worked for me :) Thanks a bunch!!!!!
     
    suma, Jun 1, 2007
    #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. =?Utf-8?B?UGF1bA==?=

    datagrid question border around cells

    =?Utf-8?B?UGF1bA==?=, Dec 6, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    371
    =?Utf-8?B?UGF1bA==?=
    Dec 7, 2004
  2. tshad
    Replies:
    0
    Views:
    2,278
    tshad
    Jan 31, 2005
  3. phl
    Replies:
    1
    Views:
    4,377
    Martin Jay
    Jun 8, 2006
  4. Coder
    Replies:
    1
    Views:
    713
    Cowboy \(Gregory A. Beamer\)
    Jun 24, 2006
  5. Anthony Jones
    Replies:
    0
    Views:
    690
    Anthony Jones
    Feb 17, 2009
Loading...

Share This Page