Hi,
I am using one link button in an asp.net application for delete purpose. For the confirmation i added the property of OnClientclick="return ValidateOnDelete();"
. By Default it works as fine. But i have One condition is that When the user is not admin, the delete button will be disabled. My problem is that, if the user clicks on the delete button when it is in disabled mode, the confirmation message will come. How it can avoid this issue?
views:
38answers:
2
A:
You could add the javascript on page load i.e Page.ClientScript.RegisterStartupScript(typeof({The Wep Page Namespace}), "{Your FunctionName}", "javascript text here", true)
Or create and hidden textbox with a flag Ie. And then during the page load set this to 1 if its an admin users
Then refer to this box in your javascript
or add the attribute at page load i.e Button1.attributes.add["OnClientclick] = "return ValidateOnDelete();"
Sp
Steven
2010-05-28 09:25:49
+1
A:
pass the button to the ValidateOnDelete() function using
OnClientclick="return ValidateOnDelete(this);"
then within the ValidateOnDelete() function do a test for the button disabled status
function ValidateOnDelete(button) {
if (button.disabled) return false;
}
Mark Baker
2010-05-28 09:26:33