Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to accelerate __doPostBack?

Posted on 2009-05-14
9
Medium Priority
?
864 Views
Last Modified: 2012-05-07
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
Comment
Question by:Abdu_Allah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 10

Assisted Solution

by:bugada
bugada earned 400 total points
ID: 24384850
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
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24384962
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
 
LVL 9

Expert Comment

by:cdaly33
ID: 24385911
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.

 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24386518
jquery is not in our plan.
0
 
LVL 9

Expert Comment

by:cdaly33
ID: 24386578
Can you use a standard Asp.net pagemethod call?
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24386618
What is  standard Asp.net pagemethod call?
0
 
LVL 9

Accepted Solution

by:
cdaly33 earned 1600 total points
ID: 24387249
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24388157
It's a good idea but is it faster than __doPostBack() function? if so why?
0
 
LVL 9

Assisted Solution

by:cdaly33
cdaly33 earned 1600 total points
ID: 24388934
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

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question