Click here to Skip to main content
15,902,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Button in asp:update panel.

<asp:Button ID="btnlaunch" runat="server" CssClass="btn_def marr_5 flt_left" Visible="false" OnClick="btnlaunch_Click" OnClientClick="javascript:disableRequestbtn();"/>

and My JavaScript

XML
<script type="text/javascript">
                                       function disableRequestbtn() {

                                           document.getElementById('<%= btnlaunch.ClientID %>').disabled = true;

                                           document.getElementById('<%= btnlaunch.ClientID %>').removeAttribute("class");

                                           alert("gg");
                                        }
                                    </script>




but its not disabled button & dont remove Class property whats the problem with it.
Posted
Updated 8-Feb-15 20:20pm
v2
Comments
jaket-cp 6-Feb-15 10:45am    
I assume the ContentPlaceHolderID="head" is in for the html head.
Is there one for the body?

1 solution

Initially you have made the button visible=false and then later I assume, you have made it visible=true. Problem is although it is now updated through update panel but Javascript may fail to find it.

Try setting visibility false through CSS like
ASP.NET
<asp:button id="btnlaunch" runat="server" cssclass="btn_def marr_5 flt_left" style="display:none;" onclick="btnlaunch_Click" onclientclick="javascript:disableRequestbtn();" xmlns:asp="#unknown" />


Hope, that helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900