PC Review


Reply
Thread Tools Rate Thread

Creating an adapter for an Image Web Control

 
 
hardieca@hotmail.com
Guest
Posts: n/a
 
      29th Dec 2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
he Catalyst Control Center is not supported by the driver version of your enabled graphics adapter. Please update your ATI graphics driver, or enable your ATI adapter using the Displays Manager. Keith Windows Vista General Discussion 23 5th Aug 2009 08:59 PM
Control image property locking image file even after image cleared steve Microsoft VB .NET 4 6th Jul 2006 02:57 AM
Creating image from control elziko Microsoft VB .NET 4 1st Jun 2004 02:44 PM
Creating drag image for a TreeView control Brett Microsoft Dot NET 0 5th May 2004 07:55 PM
Creating user control/custom image control to handle multilingual site SamIAm Microsoft ASP .NET 1 17th Oct 2003 09:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:48 AM.