我有一个名为“滚动链”的用户群,基本上包含一个<代码>:LinkButton和<img />
。 我试图将奥克克普勒同起来:
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="RolloverLink.ascx.cs" Inherits="Controls.RolloverLink" %>
<asp:LinkButton runat="server" ID="mug" OnClick="propagate"
CausesValidation="false" onmouseout="MM_swapImgRestore()" >
<img runat="server" ID="pug" name="<%# pug.ClientID %>" border="0" />
</asp:LinkButton>
我在<编码>propagate方法中设置了一个空白点,但该指示意在停止。 该网页还击(闪电),但活动没有打上。
这里,我的法典如何看待:
public partial class RolloverLink : System.Web.UI.UserControl
{
private string _imageRl;
public string Href { get; set; }
public string ImageUp { get { return pug.Src; } set { pug.Src = value; } }
public string ImageRl {
get
{
return _imageRl;
}
set
{
_imageRl = value;
mug.Attributes["onmouseover"] = "MM_swapImage( "+pug.ClientID+" , , "+_imageRl+" ,1)";
}
}
public string Alt { get { return pug.Alt; } set { pug.Alt = value; } }
public int Width { get { return pug.Width; } set { pug.Width = value; } }
public int Height { get { return pug.Height; } set { pug.Height = value; } }
public event EventHandler Click
{
add{click += value; }
remove { click -= value; }
}
private event EventHandler click;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Url.AbsolutePath.EndsWith(Href))
ImageUp = ImageRl;
}
protected void propagate(object sender, EventArgs e)
{
EventHandler copy = click;
if (copy != null)
copy(this, EventArgs.Empty);
else
Response.Redirect(Href);
}
}
这也是我如何在总页上使用:
<pwc:RolloverLink ID="contacts" Href="Contacts.aspx"
ImageRl="images/M_contacts_rl.png" ImageUp="images/M_contacts_up.png"
Alt="Initech Global : Laurierville, Québec, Canada" Width="61"
Height="17" runat="server" />
是否有任何想法或观点?