Show a waiting message -working on it- for a long running process

Thanks to Karsten:
http://www.ilikesharepoint.de/2013/04/sharepoint-create-a-wait-message-for-long-running-tasks/

Below code can be used for showing a working on it message in an application page’s button click :

function waitMessage()
{
window.parent.eval(“window.waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose(‘This should not take long.’, ”, 90, 450);”);
}

Application Page1111

My Application Page111

///////////////////////////////////
using System;
using System.Web;
using System.Web.UI;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Applications;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Diagnostics;

namespace LongRunningProject.Layouts.LongRunningProject
{
public partial class iRoomTest : LayoutsPageBase
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void btnSearch_Click(object sender, EventArgs e)
{

SPSite site = null;
string currsite = SPContext.Current.Web.Url.ToString();
try
{
using (site = new SPSite(currsite))
{
using (SPWeb web = site.AllWebs.Add(“iRoomTestingBlog”, “iRoomTestingBlog”, “This iRoomTesting1 is created by using c# code”, 1033, “BLOG#0”, true, false))
{
this.ClientScript.RegisterStartupScript(this.GetType(), “CloseWaitDialog”, @”

if (window.frameElement != null)
{
if (window.parent.waitDialog != null)
{
window.parent.waitDialog.close(); }
}
“);
Page.Response.Write(“New Website ” + web.Url);
//resConsole.WriteLine(“New Website {0}”,web.Url);
}
}
}
catch (Exception ex)
{
Response.Write(“Error —> ” + ex.ToString());
}
finally
{
site.Dispose();
}
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s