Try OnClientClick
OnClick is for sever side events.
|
|
Really?
Man, I shouldn't be surprised that MS "extended" javascript until it doesn't work any more. Your function is fine, and the browser would do exactly the right thing with it. You just can't get the server to send it to the browser.
--
Drew |
|
No, Really
MS didn't "extend" Javascript. That asp:Button tag is not HTML. It's a server side ASP.Net tag that has its own attributes. Sometimes they correspond one-to-one with HTML attributes. In this case they don't.
OnClientClick tells ASP.Net to generate an OnClick attribute containing the provided Javascript code in the resulting HTML code that is sent to the client. The server side OnClick tells ASP.Net which method to call on the server when a page posts back and the hidden event form variable indicates that the button generated by that tag was clicked. I think the root of the problem is still a misunderstanding of how ASP.Net works, specifically what happens on the server and what happens on the client and how the two communicate. http://msdn.microsof...ary/ms178472.aspx |