2

i am working on a custom web part where i have a few dropdowns in the tool pane so it take a while to load the dropdownlist and i have total three dropdownlist... i need to show the Loading message when user click on those dropdownlist in the tool pane property window

anybody have done similar to this?

2 Answers 2

1

The Client OM has features in place to interact with the Notification messages and Status bar. Check out the SP.UI namespace.

Here is the documentation on MSDN with an example: http://msdn.microsoft.com/en-us/library/ee658473.aspx

Here are some other Client OM related examples on my blog for the Status bar and ModalDialog box. http://www.mikeoryszak.com/sharepoint/use-the-status-bar-to-display-active-workflows

0

I think you will need loading message only if you use Ajax or Callback in your web part. Otherwise, the page itself will reload and hence no need of message.

If you use Ajax Updatepanel , you can use Sys.WebForms.PageRequestManager beginRequest Event to show loading image or message in a div. When request ends i.e. when you get response, you can use Sys.WebForms.PageRequestManager endRequest Event to hide the div. Below is the sample code you can use in aspx page:

//For Ajax calls
<asp:ScriptManager ID="scriptManager" runat="server" />       

//write this script at the botom of <form> tag
<script type="text/javascript">
//Hook the event handlers
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function BeginRequestHandler(sender, args) 
{
   ShowDiv();
}
function EndRequestHandler(sender, args)
{
  HideDiv();          
}

Use the script at the end of page ,otherwise you may get error "Sys.WebForms.PageRequestManager is null or not an object"

The other option is to use Updateprogress control along with updatepanel.However, I prefer client side code for this scenario.

1
  • where do you put the above code? and what show/hide code looks like?
    – Nick Kahn
    Oct 19, 2011 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.