Like AJAX, but not AJAX

When a user submits a page, i want the submit button to be disabled the text be something else like [ Loading.... ] and when the page loads after post back , the button should be enabled and the text  be [ Submit ]. Is it possible to do this without AJAX in asp.net

Noob Rocks
0
miztiik
2/6/2007 12:54:03 AM
📁 asp.net.getting-started
📃 91979 articles.
⭐ 4 followers.

💬 7 Replies
👁️‍🗨️ 2450 Views



You will need to use javascript. One way you can do it, add this attribute in the page_load event:
Button1.Attributes.Add("onclick", GetPostBackEventReference(Button1) + ";this.value='Please wait...';this.disabled = true;");
This does have its limitations, but it should work. 

www.hopeasp.net
0
CSharpSean
2/6/2007 1:06:34 AM

Are you trying to avoid the full page PostBack?  If that is the case you will not be able to avoid AJAX, but you do not need the full ASP.NET AJAX framework.
To do this without the framework you can just use a simple library like jQuery which is compact and easy to use.
http://docs.jquery.com/Ajax
Here is a sample to do what you are suggesting.  The handler (genericaHandler.ashx) should set the content type as text/xml so the response can be used as an xml document.
<script type="text/javascript" src="jquery.js" />

function handleOnSubmit() {
  $('div#loading').show();
  $ajax(url, function() { handleResponse(); }
  $.ajax({
     url: "genericHandler.ashx",
     processData: false,
     data: xmlDocument,
     success: handleResponse
 });

}

function handleResponse(data) {
  $('div#loading').hide();
  // use the data
}

</script>

<!-- button here -->
<div id="loading" style="height: 0px;">Loading...</div>
   

 

Brennan Stehling
http://www.smallsharptools.com/
http://www.linkmindr.com/
0
offwhite
2/6/2007 1:21:58 AM
May i know what are the limitations here?

Noob Rocks
0
miztiik
2/6/2007 1:24:04 AM
no validation of the the page. 


www.hopeasp.net
0
CSharpSean
2/6/2007 1:28:32 AM
no page validation.


www.hopeasp.net
0
CSharpSean
2/6/2007 1:30:43 AM

            
offwhite:

Are you trying to avoid the full page PostBack?  If that is the case you will not be able to avoid AJAX, but you do not need the full ASP.NET AJAX framework.


 The full pages does postback...but all i want to do is control the button properties during the postback/page re-load event possibly even a processing image.
 But i dont want any AJAX solutions

Noob Rocks
0
miztiik
2/6/2007 5:34:46 AM

Or you can look at this link http://www.codeproject.com/aspnet/PleaseWaitButton.asp
Thanks

Mark post(s) as "Answer" that helped you

Electronic Screw
Website||Blog||Dub@i.net
0
e_screw
2/6/2007 6:11:26 AM
Reply: