ASP.NET: Create new CSS class programmatically from User Control? -
i have usercontrol contains, among other things, 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. problem comes backgroundcssclass attribute—it requires css class called modalbackground . unfortunately cannot add css class user control in way survives postbacks. if add modalbackground class .ascx page: <style type="text/css"> .modalbackground { background-color: #a1a1a1; filter: alpha(opacity=70); opacity: 0.7px; } </style> ...it show property when first loaded, not after subsequent postbacks. of course define modalbackground within page itself, or within seperate, sta...