开发者

Saving before window closes

I am saving the data when the user closes the show model window.

var btnSave = document.getElementById('<%= btnSave.ClientID %>');
btnSave.click();
window.close();

the problem is the code is working when i am debugging the code. but when it is deployed its not executing the server side cod开发者_高级运维e on save button click and the window is closed. Please suggest how to check if the server side save operation is completed from javascript . so that i can closed the window after that.


You could have your btnSave handler on the server put some javascript into the page to close the window, rather than having your button click do it (remove window.close() from your client script). That way it definitely would not close until the server side operation completed.

In VB:

Page.ClientScript.RegisterStartupScript(Me.GetType, "CloseWindow", "window.close();", True)

In C#:

Page.ClientScript.RegisterStartupScript(this.GetType, "CloseWindow", "window.close();", true);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜