添加类以及皮肤中指定的类

时间:2022-02-07 15:37:00

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

当我们在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.

在呈现时,它没有使用“RequiredCheckClass”类,而是使用皮肤中指定的其他两个类。

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

因此,是否有任何方法可以添加一个类以及在aspx页面的皮肤中指定的类。

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....

PS:现在我将使用@Curt建议,或者使用EnableTheming=false,并将所有必需的类添加到这个控件中。请更新比这些....如果任何人有任何其他的想法

2 个解决方案

#1


2  

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.

除此之外,我不确定。我一直避免ASP。NET主题,因为我发现了它们的限制。

#2


0  

You can use the "class" property - just like you use it in a regular HTML element. thats the bypass that i am using.

您可以使用“class”属性——就像您在普通的HTML元素中使用它一样。那是我正在使用的旁路。

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

#1


2  

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.

除此之外,我不确定。我一直避免ASP。NET主题,因为我发现了它们的限制。

#2


0  

You can use the "class" property - just like you use it in a regular HTML element. thats the bypass that i am using.

您可以使用“class”属性——就像您在普通的HTML元素中使用它一样。那是我正在使用的旁路。

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