Reputation: 681
I am using a popup control with a link button inside that is used to close the popup. The problem is that the link button (or image button in the code below) is causing a full postback which is not intended. Can anyone help? below is the code.
<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>
Upvotes: 1
Views: 996
Reputation: 44941
I would change the button to a straight HTML link:
<a href="#" onclick="$find('logpop').hide(); return false;"><img src="images/sprite.png" /></a>
You can adjust the display as needed, but this should be what you need.
Upvotes: 0
Reputation: 12366
You are using it correctly, but I think there's an error in your jquery $find
. Should be
$('#logpop').hide();
or
OnClientClick="$('#logpop').hide(); return false;"
Upvotes: 2