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

  • Thread starter Thread starter kevanbulmer
  • Start date Start date
K

kevanbulmer

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
 
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"%)
 
<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...
======================
 
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...
======================
 
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
 

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

Back
Top