For Client Side code
//////////////////Wait and Close Dialog box//////////
function WaitMessage() {
window.parent.eval("window.waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Wait request is processing..', '', 90, 50);");
}
// close message
function CloseWaitDialog() {
if (window.frameElement != null) {
if (window.parent.waitDialog != null) {
window.parent.waitDialog.close();
}
}
else
{
if (window.parent.waitDialog != null)
{
window.parent.waitDialog.close();
}
}
}
//////////////////////////////
Use like below
<script>
$(document).ready(function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', readyFunction);
});
function readyFunction() {
WaitMessage();
////////////////////Write your long code here
CloseWaitDialog();
}
</script>
if you want to call it server side please put the code like below
<asp:Button runat="server" ID="Button" Text="Submit" OnClick="Button_Click" OnClientClick="javascript:WaitMessage();" />
protected void Button_Click(object sender, EventArgs e)
{
// Do the complex operations here and at the end of the complex operation, we need to close the dialog box which we opened.
this.ClientScript.RegisterStartupScript(this.GetType(), "CloseWaitDialog", @"
<script language='javascript'>
if (window.frameElement != null) {
if (window.parent.waitDialog != null) {
window.parent.waitDialog.close();
}
}
</script>");
}
//////////////////Wait and Close Dialog box//////////
function WaitMessage() {
window.parent.eval("window.waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Wait request is processing..', '', 90, 50);");
}
// close message
function CloseWaitDialog() {
if (window.frameElement != null) {
if (window.parent.waitDialog != null) {
window.parent.waitDialog.close();
}
}
else
{
if (window.parent.waitDialog != null)
{
window.parent.waitDialog.close();
}
}
}
//////////////////////////////
Use like below
<script>
$(document).ready(function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', readyFunction);
});
function readyFunction() {
WaitMessage();
////////////////////Write your long code here
CloseWaitDialog();
}
</script>
if you want to call it server side please put the code like below
<asp:Button runat="server" ID="Button" Text="Submit" OnClick="Button_Click" OnClientClick="javascript:WaitMessage();" />
protected void Button_Click(object sender, EventArgs e)
{
// Do the complex operations here and at the end of the complex operation, we need to close the dialog box which we opened.
this.ClientScript.RegisterStartupScript(this.GetType(), "CloseWaitDialog", @"
<script language='javascript'>
if (window.frameElement != null) {
if (window.parent.waitDialog != null) {
window.parent.waitDialog.close();
}
}
</script>");
}
No comments:
Post a Comment