2010-10-26 67 views
0

我知道还有其他类似的问题,但我不能得到它的工作。从asp.net窗体中关闭colorbox在iframe中提交按钮

我喜欢在iframe中点击.NET Button表单时关闭colorbox iframe。

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

按钮

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

如果有人可能还跟拼出来给我用简单的英语,将不胜感激。

非常感谢

回答

0

试试这个

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

此代码是否在iframe或MasterPage中? – Mark 2010-10-26 15:51:45

1

这是对我工作:

parent.$.colorbox.close(); 

你应该把这个你最后一行 “UpdateAddress” 并返回false所以页面不回发。如果您需要回发,然后从回发调用该行返回。