我正在使用一个带有链接按钮的弹出控件,用于关闭弹出窗口。问题是链接按钮(或下面代码中的图像按钮)导致完全回发,这是不打算的。有人可以帮忙吗?下面是代码。
<asp:PopupControlExtender ID="PopupControlLogin" BehaviorID="logpop" Position="Bottom"
TargetControlID="myLogin" PopupControlID="PanelLogin" runat="server">
</asp:PopupControlExtender>
<asp:Panel ID="PanelLogin" Style="position: absolute; display: none;" runat="server">
<div style="border: solid 1px #808080; border-width: 1px 0px;">
<div style="background: url(images/sprite.png) repeat-x 0px -200px;">
<asp:Label ID="Label2" runat="server" Style="font-weight: bold;" Text="Login" />
<asp:ImageButton ID="ImageButton1" Style="background: url(images/sprite.png) no-repeat 0px -300px;"
OnClientClick="$find('logpop').hide(); return false;" runat="server" />
</div>
<div style="background-color: #f2f2f2; width: 300px; height: 150px;">
My Content
</div>
</div>
</asp:Panel>
答案 0 :(得分:2)
您正确使用它,但我认为您的jquery $find
中存在错误。应该是
$('#logpop').hide();
或
OnClientClick="$('#logpop').hide(); return false;"
答案 1 :(得分:0)
我会将按钮更改为直接的HTML链接:
<a href="#" onclick="$find('logpop').hide(); return false;"><img src="images/sprite.png" /></a>
您可以根据需要调整显示,但这应该是您所需要的。