Search code examples
asp.netcssthemesskin

Add a class along with class specified in the skin


We are using themes to style our control.

For textbox we have added like this in the skin

<asp:TextBox runat="server" CssClass="txt edit_txt" />

Now in some cases, we want to add another class along with this 2 classes.

when we added a textbox like this in aspx

<asp:TextBox ID="txtnameE" runat="server" MaxLength="30" CssClass="RequiredCheckClass"></asp:TextBox>

On rendering it didn't take the "RequiredCheckClass" class, but only the other 2 classes specified in the skin.

So is there any way to add a class along with the classes specified in the skin from an aspx page.

PS : now i am going to use @Curt suggestion or will use EnableTheming=false and will add all the required classes to this control. Please update if anyone got any other idea other than these....


Solution

  • One option would be to create another TextBox control in the Skin file like:

    <asp:TextBox SkinID="Required" runat="server" CssClass="txt edit_txt RequiredCheckClass" />
    

    And then use the following in your markup file:

    <asp:TextBox ID="txtnameE" runat="server" MaxLength="30" SkinID="Required"></asp:TextBox>
    

    Other than that I'm not sure. I've always avoided ASP.NET Themes since I found out how restrictive they are.