Hi,
You can create a webcontrol which derives from HtmlImage.
On PreRender you have to check HttpContext.Current.Request.Browser.... to
find what is the current browser used by the client.
After that you modify or add style property and it's good.
Franck.
I don't know if you have yet created webcontrols. So i can give you a sample
i have done.
It's a webcontrol i use to change the style of an image when the mouse
hovers on.
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace eMill.UI.Web.Controls
{
/// <summary>
/// Summary description for HoverImage.
/// </summary>
public class HoverImage : HtmlImage
{
public HoverImage() {}
public string ToolTip {
get {
Object savedState = this.ViewState["ToolTip"];
if ( savedState != null ) {
return (string)savedState;
}
return string.Empty;
}
set {
this.ViewState["ToolTip"] = value;
}
}
public string HoverImageSrc {
get {
Object savedState = this.ViewState["HoverImageSrc"];
if ( savedState != null ) {
return (string)savedState;
}
return string.Empty;
}
set {
this.ViewState["HoverImageSrc"] = value;
}
}
protected override void RenderAttributes(HtmlTextWriter writer) {
if(HoverImageSrc.Length > 0) {
Attributes.Add("onmousemove", "this.src=\"" + HoverImageSrc + "\"");
Attributes.Add("onmouseout", "this.src=\"" + Src + "\"");
}
if(ToolTip.Length > 0) {
Attributes.Add("title", ToolTip);
}
base.RenderAttributes (writer);
}
}
}
Hope this helps!
Franck.
"Martin Eyles" <ma**********@NOSPAM.bytronic.com> wrote in message
news:10*************@corp.supernews.com...
| I am trying to make image alpha transparency work in IE6. I was hoping
|
| <img src="Graphics/TransparentLogo.png" width="249" height="42">
|
| would work, but it doesn't. After looking around I found the work around
|
| <div
|
style="FILTER:progid:DXImageTransform.Microsoft.Al phaImageLoader(src='Graphi
| cs/LineViewTransparentLogo.png');WIDTH:249px;HEIGHT:4 2px">
| <img src="Graphics/TransparentLogo.png" width="249" height="42"
| style="FILTER:Alpha(opacity=0)">
| </div>
|
| which works perfectly, but is very ugly. I was hoping that by using the
| asp:image tag, I would output the ugly version to IE6, and the neat
version
| to other browsers. I tried
|
| <asp:image width="249" height="42" imageurl="Graphics/TransparentLogo.png"
| alternatetext="LineViewT" runat="server" id="Image1">
| </asp:image>
|
| but this always outputs the neat non-working (in IE6) version. Is there a
| way to make it output the different version, depending on the browser is
| detects?
|
| Thanks,
| ME
|
| --
| Martin Eyles
|
ma**********@NOSPAM.bytronic.com
|
|