How I Got an Ajax Progress Bar to Work in SharePoint

So I did not really use multithreading...I went with Ajax instead and I used a button click event.  We decided that we wanted to ask the users if they are sure they want to create the site before actually creating the site.  It was so much easier in Ajax as you will see in the steps below:
  1. First off you want to download and install the ASP .Net 2.0 Ajax Extensions 1.0 from here: http://asp.net/ajax/downloads/.
  2. Next you are going to need to change the web .config a little bit on your IIS Entry for the Site Collection that you want to use Ajax on.  Here is a good reference: http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3.
  3. When you have the extensions and you have finished up with your web .config, then you want to go into the Master Page and add a script manager where you see after you see this tag:
    <WebPartPages:SPWebPartManager id="m" runat="Server" />
  4. Your code will look something like this when done:
    <WebPartPages:SPWebPartManager id="m" runat="Server" />

    <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
    Now you want to refer to open up a Web User Control and drop an UpdatePanel and UpdateProgress Control

  1. At this point you want to drop a Label and Button Control on the UpdatePanel, so that users can post back an event and see the progress bar.
  2. Next you want to drop some type of Image or Label Control.  These controls are the ones that will show up while the button click event is occurring.  This picture or label or image or whatever you want will load Asynchronously as the button click event is occurring.  It's pretty cool, because you see no page loading occurring.
    You click the button, it starts site creation and loads the image and label (I chose the gears_an.gif, which is the Official SharePoint Page Load Picture in _layouts/images).
    Add the Web User Control to SharePoint using the SMARTPart(http://www.codeplex.com/smartpart) or a Feature. 

If anyone has any questions or comments let me know.  I'm willing to answer any questions or if you have a challenge I am definitily up for one.  I love learning new things and it's most likely random people that come up with the best ideas.  I hope this was helpful.

Technorati Tags: ,,

Print | posted on Thursday, April 17, 2008 5:39 PM

Feedback

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by Daan at 4/28/2008 4:52 AM
Gravatar Hey Beckie,

Thanks for your post, it was very usefull. I made an webpart that on a mouse click will show the loadpicture until the event is finished. My question is: I want during the event that the button control is disbled and afterwards it is enabled again(so users can only click once during the event) Do you have an suggestion how to create that?
greets,

Daan

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by Becky Isserman at 4/28/2008 9:16 AM
Gravatar I would suggest hiding it in CSS and making it visible again with CSS on the click event. I am working on hiding the controls. I can post that code when I get a chance.

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by Ven at 11/7/2008 9:34 AM
Gravatar I am getting an error like this. Please help me.

An error occured during the process of /UserControls/AJAXSampleUC.ascx. The base class includes the field 'UpdatePanel1' but it's type(System.Web.UI.UpdatePanel)is not compatible with the control (System.Web.UI.UpdatePanel).

Moreover, I want to use AJAXControlToolKit.dll which has built-in controls like Accordion,TextBoxWaterMarkExtender,AutoCompleteExtender and so on, in my SPS application.

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by Ven at 11/7/2008 9:34 AM
Gravatar I am getting an error like this. Please help me.

An error occured during the process of /UserControls/AJAXSampleUC.ascx. The base class includes the field 'UpdatePanel1' but it's type(System.Web.UI.UpdatePanel)is not compatible with the control (System.Web.UI.UpdatePanel).

Moreover, I want to use AJAXControlToolKit.dll which has built-in controls like Accordion,TextBoxWaterMarkExtender,AutoCompleteExtender and so on, in my SPS application.
Please help me

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by Matt at 12/30/2008 11:33 AM
Gravatar In a basic APSX page, I've implemented an UpdateProgress control using the AlwaysVisibleControlExtender control to make my progress indicator (e.g., "Loading...") appear in a stationary location on the screen regardless of scrolling. And it works like I would expect it to. However, when I place that exact same code into the default.master page, my progress indicator will only appear in the page where I place it (and does not display "on top" and "always visible"). Would you happen to have any idea why I see a difference? My ultimate goal is to have only one progress indicator that fires when an asyncronous postback occurs, regardless of how many web parts I have using AJAX controls. Any suggestions would be appreciated.

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by Huradipraveen at 3/25/2009 3:07 AM
Gravatar i want to implement ajax in web user controls later i want to deply that sharepoint site.....
how it is possible plz help me.....
my project mainly involves web user controls....i.e ascx file to controltemplate and deploy that sharepoint site..
if i want use ajax in that web user controls is it possible? without smart pads

# re: How I Got an Ajax Progress Bar to Work in SharePoint

Left by shashilatha at 1/19/2010 5:36 PM
Gravatar Can i use AlwaysVisibleControlExtender to maintain i image independent of Page Scroll(Always Visible in the set position). Itseems it will not work in Sharepoint. If anyone has done can u pls Give me Hints..
Thanks

Your comment:





 
 

Copyright © MOSSLover

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski