Link to home
Start Free TrialLog in
Avatar of dbote
dboteFlag for United States of America

asked on

ModalPopupExtender display

I have a ModalPopupExtender on an aspx page that is displayed by a button.  The button is only visible if certain conditions about a patient exist.  If these conditions do not exist I would like the button to not display which would then not allow the ModalPopup to display either.

However, whenever I set the button visible property to false the ModalPopup is no longer a Modal Popup but a regular table on the page which always displays.

AjaxControlToolkit - 4.1.7.123

Although I do not think it matters in this case I am using VB.NET as the code behind page.

Does anyone know a work around to this behavior?

Thanks in advance,

db
Avatar of Paul Jackson
Paul Jackson
Flag of United Kingdom of Great Britain and Northern Ireland image

Instead of setting the button visibility property to false try setting the style display attribute of the button to none like :

mybutton.style = "display:none"
Avatar of dbote

ASKER

That definitely suppresses the ModalPopup but...

I have a style for the button in a CSS file that gets applied to buttons in the application.  How can I conditionally apply "display:none" in code?
ASKER CERTIFIED SOLUTION
Avatar of Paul Jackson
Paul Jackson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dbote

ASKER

Simple and easy to use.

I have never approach styles in that manner.  I'm guessing I can evaluate the Styles Item collection to see if styles exist?

Thank you for your assistance.

db
Yes you can evaluate the styles collection to see if a style exists, however I think if you add a style that already exists it overwrites its current value, so haven't really found the need to evaluate the collection in that way.
Avatar of dbote

ASKER

I was more concerned about evaluating to remove the style but the options are a plenty.  

There are so many things that just opened up in my world from this little tidbit of information.

Thanks again!

db
Glad to help.