Solved

How to accelerate __doPostBack?

Posted on 2009-05-14
9
825 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
  • 4
  • 4
9 Comments
 
LVL 10

Assisted Solution

by:bugada
bugada earned 100 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
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24386518
jquery is not in our plan.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 400 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 400 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
alert before form submission 6 27
Not showing page correctly 3 29
Remove greater than sign 3 41
ASP.net Javascript use multiple sliders 2 16
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

947 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now