When you say ASP buttons, do you mean form inputs such as submit or button?
If so, you can use the disabled property (disabled=true).
To enable and disable dynamically I don't think you can do it in ASP, but you can do it client-side in javascript or vbscript, using something like, for example...
If something then
frmForm.ButtonName.Disabled = true
end if
You could send the HTML back to the browser with the DISABLED attribute set for the button inside the button tag. This would sort of be using ASP to do it. The question I would have is do you want to disable the button under program control and if so when.
rkfox, I have an ASP page with four buttons; first, prior, next and last and a memo box. I'm getting the text of memo from a database. The problem is when it is at the beginning of the database I want to disable first and prior buttons, and when it is at the end last and next buttons.
if recordsetname.BOF then
response.write "<input type=button name=name value=prev" & _
"disabled=true>"
elseif recordsetname.EOF then
response.write "<input type=button ... =next disabled=true"
end if
%>
Might be better to do separate if blocks for both BOF and EOF...
if rs.BOF then
response.write "<input .... first.... disabled=true>"
response.write "<input .... prev .... disabled=true>"
else
response.write "<input .... first....>"
response.write "<input .... prev ....>"
end if
if rs.EOF then
response.write "<input .... last.... disabled=true>"
response.write "<input .... next.... disabled=true>"
else
response.write "<input .... last....>"
response.write "<input .... next....>"
end if
This will build your form dynamically depending on the recordset gained from your database.
Just some a quick examples for you to play around with.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.