remove the border=1 from GridView control

  • Thread starter Thread starter Andy Fish
  • Start date Start date
A

Andy Fish

hi,

I have a gridview control on my asp.net page and it generates <table ...
border="1" > in the html

i am using CSS to render the site, and everything is set up so that a plain
<table> tag generates everything looking correct. this was great for normal
tables, but datagrid screws it up.

is there any way to stop it generating the border attribute at all? it seems
pretty dumb that it is always rendering this.

Andy
 
no - gridview doesn't have an attribute called border. it has one called
"borderwidth" which is set to blank.

if I set borderwidth to anything other than blank it will output that as the
border attribute. what I want is no border attribute at all

Andy
 
no - gridview doesn't have an attribute called border. it has one called
"borderwidth" which is set to blank.

if I set borderwidth to anything other than blank it will output that as the
border attribute. what I want is no border attribute at all

Andy

Set GridLines="None"

Regards,
Mykola
http://marss.co.ua
 
I don't want no border - i want no border attribute in the html

i want it to use the standard style for a table as defined in my CSS without
overriding the border

no - gridview doesn't have an attribute called border. it has one called
"borderwidth" which is set to blank.

if I set borderwidth to anything other than blank it will output that as
the
border attribute. what I want is no border attribute at all

Andy

Set GridLines="None"

Regards,
Mykola
http://marss.co.ua
 
I don't want no border - i want no border attribute in the html

Hi Andy,

I do not like peremptory statements either, but I think you can't do
it in an easy way. If there is an essential need to get rid of border
attribute you can play with overriding of RenderControl method.

Regards,
Mykola
http://marss.co.ua
 
ok thanks

I tried overriding the pre-render method and setting

grd.Attributes["border"]="" but that generated

<table border="" border="1">

which was not exactly helpful.

Setting the cssclass causes the border attribute to be left off, so I have
ended up just having a css class table.grid which does the same thing as
table

I don't want no border - i want no border attribute in the html

Hi Andy,

I do not like peremptory statements either, but I think you can't do
it in an easy way. If there is an essential need to get rid of border
attribute you can play with overriding of RenderControl method.

Regards,
Mykola
http://marss.co.ua
 
Hi,
You can remove the border tag by selecting the Auto Format under the common control tasks of Gridview.

Go to design view of Gridview-> Click on GridView tasks->
Auto Format->Select Professional

and you no more see the border o the GridView. To change the Colors of Professional for RowStyle and AlternatingRowStyle. Go to the HTML view and change the colors accordingly.

Hope it helps.




Andy Fish wrote:

remove the border=1 from GridView control
19-Nov-07

hi

I have a gridview control on my asp.net page and it generates <table ...
border="1" > in the htm

i am using CSS to render the site, and everything is set up so that a plain
<table> tag generates everything looking correct. this was great for normal
tables, but datagrid screws it up

is there any way to stop it generating the border attribute at all? it seems
pretty dumb that it is always rendering this

Andy

Previous Posts In This Thread:

remove the border=1 from GridView control
hi

I have a gridview control on my asp.net page and it generates <table ...
border="1" > in the htm

i am using CSS to render the site, and everything is set up so that a plain
<table> tag generates everything looking correct. this was great for normal
tables, but datagrid screws it up

is there any way to stop it generating the border attribute at all? it seems
pretty dumb that it is always rendering this

Andy

Look in the Gridview attributes - probably, your Gridview has Border=1 in
Look in the Gridview attributes - probably, your Gridview has Border=1 in i

David Wie
http://aspnet101.co
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated marku


no - gridview doesn't have an attribute called border.
no - gridview doesn't have an attribute called border. it has one called
"borderwidth" which is set to blank

if I set borderwidth to anything other than blank it will output that as the
border attribute. what I want is no border attribute at al

And


I don't want no border - i want no border attribute in the htmli want it to
I don't want no border - i want no border attribute in the htm

i want it to use the standard style for a table as defined in my CSS without
overriding the borde


Set GridLines="None

Regards
Mykol
http://marss.co.ua

Re: remove the border=1 from GridView control
h

Set GridLines=3D"None

Regards
Mykol
http://marss.co.ua

Re: remove the border=1 from GridView control

Hi Andy

I do not like peremptory statements either, but I think you can't d
it in an easy way. If there is an essential need to get rid of borde
attribute you can play with overriding of RenderControl method

Regards
Mykol
http://marss.co.ua

ok thanksI tried overriding the pre-render method and settinggrd.
ok thank

I tried overriding the pre-render method and settin

grd.Attributes["border"]="" but that generate

<table border="" border="1"

which was not exactly helpful

Setting the cssclass causes the border attribute to be left off, so I have
ended up just having a css class table.grid which does the same thing as
tabl



Hi Andy,

I do not like peremptory statements either, but I think you can't do
it in an easy way. If there is an essential need to get rid of border
attribute you can play with overriding of RenderControl method.

Regards,
Mykola
http://marss.co.ua


Submitted via EggHeadCafe - Software Developer Portal of Choice
Win a free Professional license of CodeSmith Generator 5.2!
http://www.eggheadcafe.com/tutorial...sional-license-of-codesmith-generator-52.aspx
 
Back
Top