From: Syed on
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 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

Previous Posts In This Thread:

On Monday, November 19, 2007 9:46 AM
Andy Fish wrote:

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

On Monday, November 19, 2007 10:03 AM
David Wier wrote:

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


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


"Andy Fish" <ajfish(a)blueyonder.co.uk> wrote in message
news:u1EFMsrKIHA.5224(a)TK2MSFTNGP02.phx.gbl...

On Monday, November 19, 2007 10:30 AM
Andy Fish wrote:

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 all

Andy


"David Wier" <dw(a)dw.com> wrote in message
news:ue1Sq1rKIHA.5764(a)TK2MSFTNGP06.phx.gbl...

On Monday, November 19, 2007 5:18 PM
Andy Fish wrote:

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 html

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

"marss" <marss.ua(a)gmail.com> wrote in message
news:8c64acaf-4c0b-4206-a1e2-2186b5afc74c(a)f3g2000hsg.googlegroups.com...
On 19 ???, 17:30, "Andy Fish" <ajf...(a)blueyonder.co.uk> wrote:

Set GridLines="None"

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

On Tuesday, November 20, 2007 6:24 AM
marss wrote:

Re: remove the border=1 from GridView control
he

Set GridLines=3D"None"

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

On Tuesday, November 20, 2007 6:24 AM
marss wrote:

Re: remove the border=1 from GridView control
On 20 =EC=C9=D3, 00:18, "Andy Fish" <ajf...(a)blueyonder.co.uk> wrote:


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

On Wednesday, November 21, 2007 2:49 AM
Andy Fish wrote:

ok thanksI tried overriding the pre-render method and settinggrd.
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

"marss" <marss.ua(a)gmail.com> wrote in message
news:ec72167b-59a7-4d06-89bf-6f22d22b2518(a)i37g2000hsd.googlegroups.com...
On 20 ???, 00:18, "Andy Fish" <ajf...(a)blueyonder.co.uk> wrote:


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/tutorials/aspnet/32aeed64-8518-4bd0-9614-e82b5d3ab3a4/win-a-free-professional-license-of-codesmith-generator-52.aspx