开发者

Close colorbox from asp.net form Submit button in iframe

开发者 https://www.devze.com 2023-01-21 20:03 出处:网络
I\'m aware ther开发者_运维问答e are other questions similar but I just cannot get this to work.

I'm aware ther开发者_运维问答e are other questions similar but I just cannot get this to work.

Id like to close the colorbox iframe on the click of a .NET Button form within the iframe.

<script type="text/javascript">
$(document).ready(function() {
    $(".del-add").colorbox({ width: "800px", height: "660px", iframe: true, open: true });
});
</script>

Button

    <asp:ImageButton ImageUrl="~/images/update_b.jpg" ID="but2" runat="server" OnClick="UpdateAddress" Visible="true" ValidationGroup="valEnquiry" />

If someone could be kind enough to spell it out to me in plain english that would be much appreciated.

thanks very much


This is what worked for me:

parent.$.colorbox.close();

You should make this your last line in "UpdateAddress" and return false so the page doesn't postback. If you need to postback then just after returning from postback invoke that line.


Try this

$("#<%=but2.ClientID%>").click(function(){
    $.fn.colorbox.close();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消