Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 875
  • Last Modified:

How to accelerate __doPostBack?

Hi, we uses __doPostBack in our application we feel it's too slow , is there any way to accelerate it?
The following is a JS code example from our application:
function CallServerFunction(command,arg) 
    { 
        var hiddenID = 'HiddenField1';
        var hiddenField = document.getElementById(hiddenID); 
        hiddenField.value = command + "," + arg; 
        __doPostBack(hiddenID,arg)     
    }

Open in new window

0
Abdu_Allah
Asked:
Abdu_Allah
  • 4
  • 4
3 Solutions
 
bugadaCommented:
A post back will reload the whole page. It also posts all the view state data with it which means more traffic. Are you sure you need it? Or maybe a simple ajax call can do the job?
0
 
Abdu_AllahAuthor Commented:
As you can see from the code, we use __doPostBack function to send a value to a server side code to act based on that value. Is there any faster alternative?
0
 
cdaly33Commented:
If you could include a javascript utility like jquery then you can pass the hidden field value to an asp.net pagemethod.  See the link below for how to set it up.
http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Abdu_AllahAuthor Commented:
jquery is not in our plan.
0
 
cdaly33Commented:
Can you use a standard Asp.net pagemethod call?
0
 
Abdu_AllahAuthor Commented:
What is  standard Asp.net pagemethod call?
0
 
Abdu_AllahAuthor Commented:
It's a good idea but is it faster than __doPostBack() function? if so why?
0
 
cdaly33Commented:
It's faster because it doesn't have to send and retrieve all of the forms data.  It will only send and receive what is necessary for the function call.  A postback will cause the browser to rerender the entire form where as a pagemethod will only affect the fields that you want it to affect.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now