views:

93

answers:

4

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 on the delete button it shows the delete confirm box. what i do for avoiding this Magic ?

+1  A: 

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

Jonathan Sampson
i meant lnkBtn.enabled= true;
Dilse Naaz
A: 
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.

Pete Duncanson
+2  A: 

Hi!

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;"); 
Guilherme Ferreira
A: 

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

Ricardo