User-879100993 posted
Trying to create a clickable image with mouseout image as a custom control.
Problem is : when I set all properties on the aspx page, everything works fine, but when I try the same properties programatically - even though the control accepts it, but does not reflect the values. They are always empty.
Here is what works properly:
<wiz1:hoverimagelink runat="<span" class="st">"Server" ID="HoverLink1" ImageUrl="~/img/but-takeaction2.jpg" ImageHoverUrl="~/img/but-takeaction1.jpg" /> </wiz1:hoverimagelink>
But when I try it programatically on postback like the following line, it fails:
HoverLink1.ImageHoverUrl = "~/img/but-takeaction1.jpg";
The output comes something like this in this case:
"HoverLink1" onmouseover="ShowImageHoverButton(this, '')" onmouseout="ShowImageHoverButton(this, '/wiz.net/WizLibrary/img/but-takeaction2.jpg')"
onclick="window.location=''" src="/wiz.net/WizLibrary/img/but-takeaction2.jpg" style="border-width: 0px; cursor: pointer;">
I have unsuccessfully tried setting attributes like "PersistenceMode, Bindable, Localizable" and so on but it simply fails to get the value.
For any of you who need to know, how I define the properties themselves, here's one of them:
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
[Localizable(false)]
[PersistenceMode( PersistenceMode.Attribute)]
[UrlProperty(), Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)), Themeable(false)]
public string ImageHoverUrl
{
get
{
this.EnableViewState = true;
String s = (String)ViewState["ImageHoverUrl"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["ImageHoverUrl"] = value;
}
}