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

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
 
T

Teemu Keiski

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"%)
 
K

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
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top