c# - how to detect the textBox element which is not validated and add some css style to that textbox afterwards using asp validation controls? -


i using asp validation controls validate form <asp:textbox>s in page.giving error message not-validated textbox pretty easy using error message attribute in <asp:validation> controls.the thing want want textboxes become red when not validated.to achieve goal (i'm guessing that) need detect not-validated textbox , give special style using css.but have no idea how!

for example @ code:

<form id="form1" runat="server"> <div>     <div>         username: <br />         <asp:textbox id="txtboxusername" runat="server"></asp:textbox>         <asp:requiredfieldvalidator id="usernamereq" controltovalidate="txtboxusername" errormessage="username required!!!" setfocusonerror="true" runat="server">         </asp:requiredfieldvalidator><br />         password: <br />         <asp:textbox id="txtboxpassword" textmode="password" runat="server"></asp:textbox>         <asp:requiredfieldvalidator id="passwordreq" controltovalidate="txtboxpassword" errormessage="password required!!!!" setfocusonerror="true" runat="server"></asp:requiredfieldvalidator><br />         <asp:button id="submitbutton" text="submit" runat="server" />     </div> </div> </form> 

i want username , password textboxes become red when user doesn't type in them!(to clear,i want on other types of validations too,and code above example)


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -