I have a UserControl which contains, among other things, this AJAX modal popup extender:
<ajax:ModalPopupExtender ID="MPE" runat="server"
TargetControlID="btnChangePassword" PopupControlID="pnlPasswordChanging"
BackgroundCssClass="modalBackground" DropShadow="true"
CancelControlID="btnCancel" OnCancelScript="ULC_ChangePw_CancelBtnClick();" />
Nothing special here. The problem comes from that BackgroundCssClass
attribute—it requires a CSS class called modalBackground. Unfortunately I cannot add a CSS class from a user control in a way that survives postbacks.
If I add my modalBackground class to the .ascx page:
<style type="text/css">
.modalBackground
{
background-color: #A1A1A1;
filter: alpha(opacity=70);
opacity: 0.7px;
}
</style>
...it will show up property when first loaded, but not so after subsequent postbacks. Of course I could define modalBackground within the page itself, or within a seperate, standalone CSS file that is called by the user control, but neither solution will work for me.
Is there no way to create a CSS class programmatically and add it to the page? Basically I'm looking for a CSS equivilant to Javascript's RegisterClientScriptBlock
function:
Dim controlNameScript = String.Format("<script type='text/javascript'> var AppMenuName = '{0}' </script>", Me.ClientID)
Me.Page.ClientScript.RegisterClientScriptBlock(myType, "ControlName", controlNameScript)
Thanks!