【发布时间】:2010-01-04 14:08:59
【问题描述】:
我有一个 asp:GridView,里面有一些 TemplateFiled,其中一个用于向用户显示 HoverMenu 面板
更详细地说,gridview 显示个人信息,当用户将鼠标悬停在该行上时,会出现一个面板并显示完整信息。
这是模板字段
<asp:TemplateField meta:resourcekey="grdListTemplateFieldID">
<ItemTemplate>
<asp:HoverMenuExtender ID="HoverMenuExtender" runat="server"
PopupControlID="PopupMenu" PopupPosition="Center" OffsetY="30" OffsetX="10" PopDelay="50"
HoverCssClass="hoverMenu" >
</asp:HoverMenuExtender>
<asp:Panel ID="PopupMenu" CssClass="popupMenu" runat="server">
<div id="RequestHoverTitle">
<asp:Label ID="lblTitle" runat="server" meta:resourcekey="lblTitle" />
</div>
<div id="NameContainer">
<asp:Label ID="lblFullName" runat="server" SkinID="BoldLabel" meta:resourcekey="lblFullName" />
<asp:Label ID="lblReqName" runat="server" SkinID="ListLabel" Text='<%# Eval("Name") %>' />
<asp:Label ID="lblReqLastName" runat="server" SkinID="ListLabel" Text='<%# Eval("Family") %>' />
</div>
。 .其他一些数据 .
在后面的代码中,我有一个方法可以将 ID(dataKeyname)提供给面板以用于其内部工作
protected void grdList_RowDataBound(object sender, GridViewRowEventArgs e)
{
HoverMenuExtender hoverMenu = e.Row.FindControl("HoverMenuExtender") as HoverMenuExtender;
if (hoverMenu != null)
{
e.Row.Attributes["id"] = e.Row.ClientID;
hoverMenu.TargetControlID = e.Row.UniqueID;
}
}
最后一切对我来说都很好
这段代码有两个问题
首先:如果用户退出带有提供的注销链接的页面(在母版页中)将看到
The TargetControlID of 'HoverMenuExtender' is not valid. The value cannot be null or empty.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Source Error:
每当我想回发页面时,都会出现此消息(如果发生提交过程,或文件上传,反之亦然
任何帮助appriciated
【问题讨论】:
-
forum.asp.net 可能是解决此类问题的更好地方。因为我之前对 AjaxControlToolkit 有一些疑问,但在 StackOverflow.com 上没有得到很好的反馈
标签: c# asp.net asp.net-ajax ajaxcontroltoolkit