miko1
miko1

Reputation: 35

Css validation do not work in asp net

i cant use css validation class inside asp.net controls but all other css design works correctly for example i just need to add class="validate[required]" to make a control validation in html but the same is not working for asp.net textbox controls i tried CssClass too didnt work. please help, thanks in advance

<asp:TextBox ID="txt_uname" runat="server" Height="25" CssClass="validate[required]"></asp:TextBox>

Upvotes: 0

Views: 692

Answers (1)

Sachin
Sachin

Reputation: 40970

validate[required]

This is not a valid css class name. This declaration means validate class will apply to those elements, which have required attribute.

Your css class

.validate[required]
{
  color:Red;
}

So try this

<asp:TextBox ID="txtUsername" runat="server" CssClass="validate" required="required"></asp:TextBox>

Upvotes: 3

Related Questions