Hi,
I would like to create an adapter for the image web control to cure a
pet peeve of mine. Currently, if I write out:
<asp:Image ImageUrl="myPic.jpg" AlternateText="Some text"
runat="server" />
the html that is emitted is:
<img src="myPic.jpg" alt="Some text" style="border-width:0px" />
I would like that inline style struck out completely for every image on
my site. As it turns out, in the System.Web.UI.WebControls.Image class
resides the AddAttributesToRender method. At the very bottom in an IF
statement, the following:
else
{
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
}
I think creating a control adapter (described at
http://msdn.microsoft.com/msdnmag/is...ExtremeASPNET/) would be
the most elegant solution, but I'm unsure as to how to tackle this.
It's my understanding that the adapter replaces the control's rendering
logic, but at the end of the day I only want to edit an IF statement.
I don't want to have to re-invent the wheel to replace the
System.Web.UI.WebControls.Image and
System.Web.UI.WebControls.WebControl classes rendering logic. Is there
a simple way to achieve this?
Kind regards,
Chris