Within my UserControl, there is an AJAX modal popup extender that is causing me some trouble:
<ajax:ModalPopupExtender ID="MPE" runat="server"
TargetControlID="btnChangePassword" PopupControlID="pnlPasswordChanging"
BackgroundCssClass="modalBackground" DropShadow="true"
CancelControlID="btnCancel" OnCancelScript="ULC_ChangePw_CancelBtnClick();" />
The issue lies with the BackgroundCssClass
attribute which requires a CSS class named modalBackground. Unfortunately, I am unable to add this CSS class in a way that persists through postbacks within the user control.
If I include the modalBackground class in the .ascx page like this:
<style type="text/css">
.modalBackground
{
background-color: #A1A1A1;
filter: alpha(opacity=70);
opacity: 0.7px;
}
</style>
It display correctly when initially loaded, but disappears after subsequent postbacks. Adding modalBackground directly within the page or in a separate CSS file called by the user control are not viable solutions for me.
Is there a way to programmatically create a CSS class and apply it to the page? Essentially, I am searching for a CSS equivalent 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)
Any help or suggestions would be greatly appreciated. Thank you!