Reputation: 1
I have a JavaScript timer, on time out I am given an alert, after which I have to call a method. For that I have taken a temporary button and onClick I call the method like this:
__doPostBack('btn','Click');
But it is going to page load, and not the click event of the button. What is the solution to this?
Upvotes: 0
Views: 920
Reputation: 6996
PostBack is the name given to the process of submitting an ASP.NET page to the server for processing .
Examples -- 1) a login page. After the user has typed in his credentials, he clicks on the ‘Login’ button. OnClick, the page is sent to the server to check against the DB/XML file to check if the user with supplied details is an authenticated user or not.
2) There also arise certain situations wherein, you would want to do a PostBack, say you have 2 combo-boxes, Country and State, based on the value selected in the Country combo-box, the values in the state combo-box will be populated. So in this case, once the value from the Country combo-box is selected, data is "Posted-Back" to the server to retrieve the values to be populated in the State Combo-box.
Also, every time a PostBack is done, the Page-Life cycle is executed once the request comes back to the client. Hence in your case, once you do the postBack, the PageLoad() is called.
Upvotes: 1