Datagrid generating duplicate border attribute

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
 
G

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
 
T

tshad

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
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top