Datagrid generating duplicate border attribute

Discussion in 'ASP .Net' started by tshad, Apr 8, 2005.

  1. tshad

    tshad Guest

    Why is the Datagrid creating a multiple border attribute?

    With this code:

    <asp:DataGrid AllowPaging="true"
    AllowCustomPaging="false"
    PageSize="4"
    PagerStyle-Visible="false"
    visible="false"
    AllowSorting="True"
    AutoGenerateColumns="false"
    CellPadding="3"
    CellSpacing="0"
    ID="DataGrid2"
    runat="server"
    ShowFooter="false"
    ShowHeader="true"
    OnSortCommand="SortDataGrid"
    border="1"
    BorderColor="#999999"
    style="margin:auto;">

    I am getting this:

    <table cellspacing="0" cellpadding="3" rules="all" border="1"
    bordercolor="#999999" border="1" id="DataGrid1" style="margin: auto; ">


    Why am I getting 2 Border attributes?

    This is causing some of my code to work funny.

    Thanks,

    Tom
     
    tshad, Apr 8, 2005
    #1
    1. Advertisements

  2. tshad

    Guest Guest

    Hi Tshad,

    The "border" attribute you used in your tag is actually an HTML attribute,
    the server-side "BorderWidth" attribute is assuming a default size of 1 since
    it is not present and translates into the same border attribute that you
    used. To solve the problem, remove the incorrect "border" attribute or
    replace it with "BorderWidth"

    Cheers,
    Steve Goodyear
    Vancouver, Canada
     
    Guest, Apr 8, 2005
    #2
    1. Advertisements

  3. tshad

    tshad Guest

    You're right.

    But when I changed it to:

    <asp:DataGrid AllowPaging="true"
    AllowCustomPaging="false"
    PageSize="4"
    PagerStyle-Visible="false"
    Visible=false
    AllowSorting="True"
    AutoGenerateColumns="false"
    CellPadding="3"
    CellSpacing="0"
    ID="DataGrid1"
    runat="server"
    ShowFooter="false"
    ShowHeader="true"
    OnSortCommand="SortDataGrid"
    BorderWidth="0"
    style="margin: auto; ">

    I took out the border, bordercolor and added in the borderwidth.

    I still have the rules="all", which gets rid of the outside border but
    leaves the inside border (rules) on.

    <table cellspacing="0" cellpadding="3" rules="all" border="0" id="DataGrid1"
    style="margin: auto; ">

    What is causing that?

    Thanks,

    Tom
     
    tshad, Apr 8, 2005
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.