I have a call in my codebehind that looks like:
bool isQtyValid = true;
bool disabled = false;
foreach(parameters)
{
//setting isQtyValid
if (!isQtyValid)
disabled = true;
Page.ClientScript.RegisterStartupScript(this.GetType(), "function", string.Format("SetButtonStatus('{0}')", disabled.ToString().ToLower()), true);
}
then my javascript looks like:
function SetButtonStatus(disabled) {
var bb = document.getElementsByClassName('ButtonSubmit');
for (var i = 0; i < bb.length; i++) {
bb[i].disabled = disabled;
}
}
For some reason this will only work one way. If it gets set to disabled = true, it won't go back to being enabled, and if it gets set to disabled = false, it won't go back to being disabled. I have looked at the variable to see if it is being set right, and it does change from true to false and false to true when it should, but it doesn't change the disabled state of the button.
Am I missing any little things that you can see?
Thank you for any help you can give me.
!a typo not present on your real code?function SetButtonStatus(!isQtyValid)