Wednesday, March 28, 2012

Disable Atlas things at runtime

I've got a form i am trying to create that if:

An administrator is logged in, a textbox with an AutoCompleteExtender (and TextWaterMark control as well) is available for the Admin to search for companies to look at data for

If it's a company logged in, i want to hide/disable this textbox and instead give them a dropdownlist of their assigned company (or companies) and not allow them to search for companies outside of them

the problem i am running into is that when i set the textbox to "visble = false", that causes Atlas to throw an error "Assertion Failed, could not find HTML element blah blah blah"...

I thought i'd be sneaky and instead of saying:
txtCompany.Visible = False

I instead said in the code
txtCompany.Style.Add("display", "none")

but that still errored, althought this time just a "runtime error has occured"

How can i simply say in code:

"If i am not an administrator, turn off the textbox, autocomplete, and watermark"

I'd probably put the entire textbox (atlas update panel included) inside a usercontrol, and show and hide the usercontrol accordinly.
Excellent suggestion and appears to be doing exactly what i want it to do......

No comments:

Post a Comment