Solved

How to accelerate __doPostBack?

Posted on 2009-05-14
9
819 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
jquery is not in our plan.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 9

Expert Comment

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

Author Comment

by:Abdu_Allah
Comment Utility
What is  standard Asp.net pagemethod call?
0
 
LVL 9

Accepted Solution

by:
cdaly33 earned 400 total points
Comment Utility
0
 
LVL 3

Author Comment

by:Abdu_Allah
Comment Utility
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
Comment Utility
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now