Chris,
You may find some success with the CSS Control Adapters.
http://www.asp.net/cssadapters/ Scott Guthrie explains them here. They are quite powerful.
http://weblogs.asp.net/scottgu/archive/2006/05/02/CSS-Control-Adapter-Toolkit-for-ASP.NET-2.0-.aspx Brennan Stehling
http://brennan.offwhite.net/blog/ [quoted text, click to view] hardieca@hotmail.com wrote:
> 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 custom adapter 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