javascript - ASP.NET - onclick attribute added to Button means page cannot determine source of postback -


i've added javascript onclick of button in asp.net disable button (in order prevent user submitting form twice).

when click button, page posts fine no control event handler runs - asp.net seems unable determine control posted page back.

i'm bit stumped unexpected behaviour. can explain , suggest alternative way of doing this?

try this:

<asp:button id="button1" usesubmitbehavior="false"       onclientclick="javascript:document.getelementbyid('button1').disabled = true;    __dopostback('__page', '');"       onclick="button1_click" runat="server" text="button" /> 

it'll come through no request inspection needed.

after comment how add onclick: add _dopostback('_page', 'yourbuttonname') , inspect event args on server side.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -