0

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?

2
  • read about what a "PostBack" is, you'll get the answer to your question. Commented Mar 30, 2011 at 7:18
  • I think __doPostBack is an internal method for ASP.NET pages. You are not supposed to call it directly. As @Tarun has commented, it does a postback. You don't seem to understand what a postback is. Commented Mar 30, 2011 at 7:46

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.