Geeks With Blogs

About Me:
I am a Female SharePoint Developer (a platinum unicorn). I have been working with SharePoint since I attended the Portal University in 2005. I hold a BA in Computer Science from the University of Missouri - Kansas City. I love playing Rockband, organizing user group meetings, working with code, attending events as a speaker or organizer, and having bizarre conversations about geek things with cool people. If you have any comments or questions fill out the contact form and I will try my best to help.

The Guide of a MOSSLover Becky Isserman's Blog

If you want to show the progress bar please refer back to this post on how to get an AJAX Progress Bar to work with SharePoint:

For the next step you want to create a Javascript Function in your user control or web part that looks a little bit like this:

<script type="javascript/text" >

           var Button1 = <%= Button1.ClientID %>';


If you wanted to do the same thing in a Web Part, then it would look more like this:
string functionHideButtons = "<script type=\"javascript/text\" >\n";
functionHideButtons += "HideButtons()\n";
functionHideButtons += "{\n";
functionHideButtons += "var Button1 = <%= Button1.ClientID %>';\n";
functionHideButtons +=
functionHideButtons += "}\n";
functionHideButtons += "</script>\n";

If you have a Cancel Button too, then you may want to add two different functions.  So maybe a CancelHide and a EventHide or something relational to whatever event your button click will do.  If you have followed my instructions on how to insert the proper UpdatePanel and UpdateProgress Controls, then all you need to do is add the part to link the Javascript Function to the button click event.

In a Web User Control your code you would add this code just before the /> in your button markup:

If you are working with a Web Part, instead of adding the above code you would put this piece of code in your Render Method: 
Button1.ClientOnClickScript = "HideButtons()";

If anyone has any questions or comments please feel free to ask them.  If you would like another post on AJAX Controls as related to Web Parts, then I would be more than willing to add another post if someone asks for it.  I am hoping to post within the next week on how to load a page by using a hidden button click and not forgoing any use of threading.

Technorati Tags: ,,,
Posted on Wednesday, April 30, 2008 8:20 PM | Back to top

Comments on this post: Hiding Buttons After Clicking Them and Showing a Progress Bar in AJAX

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © MOSSLover | Powered by: