By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,559 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,559 IT Pros & Developers. It's quick & easy.

ASP.NET image - remove border attribute (c#)

P: n/a
c#

by default the 'border' attribute is added to an asp.net image, how do
i remove this attribute, as i cant validate my page as xhtml 1.1

thanks
kb

Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If you specify it like this

<asp:Image Runat="server" BorderWidth="0px" />

That is, specify it explicitly that you have BorderWidth 0px when it in IE
renders the width into style and there won't be the border attribute. To
make it work with other browsers (styles work by default only with uplevel
browsers), set Page's ClientTarget to uplevel (%@Page
ClientTarget="uplevel"%)

--
Teemu Keiski
ASP.NET MVP, Finland

<ke*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
c#

by default the 'border' attribute is added to an asp.net image, how do
i remove this attribute, as i cant validate my page as xhtml 1.1

thanks
kb

Nov 19 '05 #2

P: n/a
<asp:Image ID="Image1" Runat="server" BorderStyle="None" />

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

<ke*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
c#

by default the 'border' attribute is added to an asp.net image, how do
i remove this attribute, as i cant validate my page as xhtml 1.1

thanks
kb

Nov 19 '05 #3

P: n/a
Teemu,

doesn't BorderStyle override BorderWidth ?

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:Ox**************@TK2MSFTNGP14.phx.gbl...
If you specify it like this

<asp:Image Runat="server" BorderWidth="0px" />

That is, specify it explicitly that you have BorderWidth 0px when it in IE renders the
width into style and there won't be the border attribute. To make it work with other
browsers (styles work by default only with uplevel browsers), set Page's ClientTarget to
uplevel (%@Page ClientTarget="uplevel"%)

--
Teemu Keiski
ASP.NET MVP, Finland

<ke*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
c#

by default the 'border' attribute is added to an asp.net image, how do
i remove this attribute, as i cant validate my page as xhtml 1.1

thanks
kb


Nov 19 '05 #4

P: n/a
KB
thanks for the replies, but using BorderStyle does remove the border
attribute, which is great!! but using this property, applies inline styling,
which cause other problems for me

how can i just render an asp.net image to have this output:

<img src="myImage" id="Image1">

your suggestion of using BorderStyle proves that the border attribute can be
removed, surely this can be done programmatically??

thanks
kb

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
<asp:Image ID="Image1" Runat="server" BorderStyle="None" />

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

<ke*********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
c#

by default the 'border' attribute is added to an asp.net image, how do
i remove this attribute, as i cant validate my page as xhtml 1.1

thanks
kb


Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.