Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
--When to use _dopostback ? In what scenario this _dopostback seems very useful? Kindly explain me.
Posted

Hi,
_dopostback is used to perform a PostBack from javascript and is similar to document.getElementById('buttonID').click(); Normally we use these techniques to forcefully perform a post back.
An example is you have open a popup from your page and on the popup control you perform some data save operations. Now you want to update your parent page Listview/Gridview/repeater to rebind. Then you may use _dopostback or document.getElementById('buttonID').click(); perform a postback and on the button click event reload the desired data.
 
Share this answer
 
v2
Comments
Thanks7872 14-Oct-13 3:43am    
What? similar to ('buttonID').click();?
anurag19289 14-Oct-13 4:03am    
Hi Tanweer-

What i understood is : Suppose you have a gridview as below. And on searchbutton the grid populates as below.

column1 is routecolumn2 is number of routes.

column3 is linkbutton which opens the popup.

column1 column2 column3

route1 4 linkbutton
route2 5 linkbutton

Now you click the linkbutton of route1 and add one record. And when you close the popup. The count which was 4 for route1 is not increased to 5. So you peroform _dopostback before you close the window and pass searchbutton as event target value to the postback function and the grid populates again and the records are displayed correctly.

Kindly correct me if i am wrong.
tanweer 14-Oct-13 4:32am    
Yes thats what i was trying to explain you.
anurag19289 14-Oct-13 5:03am    
ok :)
You can check the below link for an understanding of _dopostback

http://dotnetprof.blogspot.in/2012/08/dopostback-function-in-javascript.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900