IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 1 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Try OnClientClick
OnClick is for sever side events.
New 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
New 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
Expand Edited by altmann March 17, 2009, 03:28:25 PM EDT
     2 different event responses to one Click event? - (lincoln) - (6)
         return false - (drook) - (5)
             Tried this, but get a compile/build error - (lincoln) - (4)
                 Try OnClientClick - (altmann) - (2)
                     Really? - (drook) - (1)
                         No, Really - (altmann)
                 Re: Tried this, but get a compile/build error - (lincoln)

THEN WHO WAS PHONE?
74 ms