Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
danasegarane76
Posting Yak Master
242 Posts |
Posted - 2008-01-04 : 03:47:29
|
Hi all,I am using one client side button in my form.The code behind of the form has a public varriableAction as Integer.If the varraible is 1 then the button has to be disabled else it has to be enabled.I am tryinglike this but not working.Can some one helpbutton class="Btn" id="Button3" title="ALT-D" accessKey="D" onclick="Delete_onclick()" type="button" > <% If intAction = 1 then %> <disabled="true" > <% Else %> <disabled="false" > <%End If %> </button> Thanks in AdvanceDana |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-01-04 : 13:54:13
|
It doesn't work because you have already closed the button tag. If you leave the tag open, and then close it after your IF block, that should work fine. Or, you can do it inline using the iif() function if you like this:<button class="Btn" id="Button3" title="ALT-D" accessKey="D" onclick="Delete_onclick()" type="button" disable='<%= iif(intAction=1,"true","false")%>'> Your other option is to put a runat="server" attribute on the button and set it via your ASP.NET code, or use a asp.net button control.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
mukunda
Starting Member
4 Posts |
Posted - 2008-01-24 : 06:46:09
|
Another way is call javascript function on page laodvar flag=<%=intAction%>function disablebutton(){ if (flag=="1") { document.getElementById("Button3").disabled=true; }}Thanks Mukund |
|
|
|
|
|