开发者

Button disabled.. But

开发者 https://www.devze.com 2022-12-16 17:04 出处:网络
I have one form, it includes 3 text boxes and 2 link button as Edit and delete. these controls are Operated (enabling & disabling)by a Button. On loading the delete button enable property set to f

I have one form, it includes 3 text boxes and 2 link button as Edit and delete. these controls are Operated (enabling & disabling)by a Button. On loading the delete button enable property set to false. but when i click开发者_StackOverflow on the delete button it shows the delete confirm box. what i do for avoiding this Magic ?


Has you can see at this page, Enable = False is what you want talking about ASP.NET

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button_members.aspx

Your problem is that you have onClientClick code to show confirm box, and this is Javascript, so is client Code....

use this...

myButton.Attributes.Add("onclick", "this.disabled=true;"); 


I'm not sure what you mean by "enable property." To disable a button you use the 'disabled' property: http://www.w3schools.com/tags/att_input_disabled.asp - I was unable to reproduce your issue when I added the 'disabled' attribute.

Online Example at http://jsbin.com/egini


lnkBtn.enabled=true; 

would only work Server-side as JS and HTML don't have a "enabled" property but .net does?

lnkBtn.disabled = false;

Is the client side version, this would work with JS and HTML only.


A simpler approach would be to just set the "visible' property of this button to false until you actually need it.

0

精彩评论

暂无评论...
验证码 换一张
取 消