Datagrid generating duplicate border attribute

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

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
 
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
 
Steve Goodyear said:
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"

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
 
Back
Top