Close colorbox from asp.net form Submit button in iframe
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();
});
精彩评论