2010-10-26 65 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所以頁面不回發。如果您需要回發,然後從回發調用該行返回。