asp.net - JavaScript How to enabled button on client-side on CallBack and Postback -



asp.net - JavaScript How to enabled button on client-side on CallBack and Postback -

i have asp.net page 2 buttons. 1 triggers , updatepanel (ajax callback). other total page refresh (postback).

i need disable both buttons when of them clicked (this part manage create work) , reenabled them when postback or callback complete. wich event or on javascript should phone call function enabled buttons in both cases?

thanks!

edit

here's code. buttons definition:

<asp:button id="cmdfiltrar" usesubmitbehavior="false" style="width:48%" runat="server" cssclass="botonactivo" text="<%$ resources:idioma, historico_consultar%>"/> <asp:button id="cmdexcel" usesubmitbehavior="false" style="width:48%" runat="server" cssclass="botonactivo" text="<%$ resources:idioma, historico_excel%>"/>

on page_load (server side) define javascript function enabled/disabled buttons, , add together attribute both buttons phone call on click:

clientscript.registerclientscriptblock(page.gettype(), "estadobotones", "function estadobotones(bactivo) {document.getelementbyid('" + cmdexcel.clientid + "').disabled=bactivo;document.getelementbyid('" + cmdfiltrar.clientid + "').disabled=bactivo;}", true) cmdfiltrar.attributes.add("onclick", "javascript:" + "estadobotones(true);") cmdexcel.attributes.add("onclick", "javascript:" + "estadobotones(true);")

now need know set line of code (javascript):

estadobotones(false);

to re-enable both buttons. idea? thanks!

edit2 suggested @shouvik, edit code-behind in page_load event:

page.clientscript.registerclientscriptblock(page.gettype(), "estadobotones", "function estadobotones(bactivo) {document.getelementbyid('" + cmdexcel.clientid + "').disabled=bactivo;document.getelementbyid('" + cmdfiltrar.clientid + "').disabled=bactivo;}", true) cmdfiltrar.attributes.add("onclick", "javascript:" + "estadobotones(true);") cmdexcel.attributes.add("onclick", "javascript:" + "estadobotones(true);") page.clientscript.registerstartupscript(page.gettype(), "activarbotones", "estadobotones(false);", true)

the lastly line gets executed on code-behind, buttons on client side did not enabled should...

javascript asp.net

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -