Sunday, March 11, 2012

Is it possible to set AlwaysVisibleControl invisible?

Yep. The control still renders out as whatever the control renders as (if that makes sense). e.g. you could apply an AlwaysVisibleControlExtender to a div with runat='server' or a panel with runat='server' and in either case they'd render in the html as a div with the same id (unless using master pages in which case you'll have to do a little more work to get the unique id).

So, since I like declarative markup, I'd setup a div or panel with an id (let's say id='alwaysVis'), and then I'd grab that control in the xml-script and set a couple properties thusly:

<control id="alwaysVis" visibilityMode="collapse" visible="true" />

Then I'd have a button insdie that div or panel, let's name it id='closeButton' that I'd grab in the xml-script thusly:

<button id="closeButton"> <click> <setProperty target="alwaysVis" property="visible" value="false" /> </click></button>
Hope that helps.Paul

No comments:

Post a Comment