javascript - Mark up ASP.net validator -
i have created simple webform using designer in asp.net (vs2013). system works well, had use few textboxes , custom validation controls toolbox. form checks client sided if input correct , shows error message if not.
however errormessage gets shown on page in ugly red text atm. mark-up error message, example use jquery fade-in function on error or use custom javascript hook in emited js asp.
what , best way this?
code:
<%@ page language="c#" autoeventwireup="true" codefile="registreren.aspx.cs" inherits="registreren" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script type="text/javascript" src="scripts/jquery.js"></script> <title></title> <link href="websitestyle.css" type="text/css" rel="stylesheet" /> </head> <body> <form id="form1" runat="server"> <div style="height: 244px"> <table class="auto-style1"> <tr> <td class="auto-style2" rowspan="1">username</td> <td class="auto-style7" rowspan="1"> <asp:textbox id="textboxusername" runat="server" width="240px"></asp:textbox> </td> <td rowspan="1"> <asp:requiredfieldvalidator id="requiredusername" runat="server" controltovalidate="textboxusername" errormessage="please enter username." cssclass="validationerror"></asp:requiredfieldvalidator> </td> </tr> <tr> <td class="auto-style3" rowspan="1">email</td> <td class="auto-style6" rowspan="1"> <asp:textbox id="textboxemail" runat="server" width="240px"></asp:textbox> </td> <td class="auto-style4" rowspan="1"> <asp:requiredfieldvalidator id="requiredemail" runat="server" controltovalidate="textboxemail" errormessage="please enter emailaddress." cssclass="validationerror"></asp:requiredfieldvalidator> </td> </tr> <tr> <td class="auto-style2" rowspan="1">password</td> <td class="auto-style7" rowspan="1"> <asp:textbox id="textboxpassword" runat="server" width="240px" textmode="password"></asp:textbox> </td> <td rowspan="1"> <asp:requiredfieldvalidator id="requiredpassword" runat="server" controltovalidate="textboxpassword" errormessage="please enter password." cssclass="validationerror"></asp:requiredfieldvalidator> </td> </tr> <tr> <td class="auto-style2" rowspan="1">confirm password</td> <td class="auto-style7" rowspan="1"> <asp:textbox id="textboxconfirmpassword" runat="server" width="240px" textmode="password"></asp:textbox> </td> <td rowspan="1"> <asp:customvalidator id="requiredconfirmpassword" runat="server" controltovalidate="textboxconfirmpassword" errormessage="please confirm password." clientvalidationfunction="validateconfirmpassword" validateemptytext="true" cssclass="validationerror"></asp:customvalidator> </td> </tr> <tr> <td class="auto-style2" rowspan="1">country</td> <td class="auto-style7" rowspan="1"> <asp:dropdownlist id="dropdownlistselectcountry" runat="server" height="16px" onselectedindexchanged="dropdownlist1_selectedindexchanged" width="240px"> <asp:listitem>select country</asp:listitem> <asp:listitem>the netherlands</asp:listitem> <asp:listitem>belgium</asp:listitem> <asp:listitem>france</asp:listitem> <asp:listitem>germany</asp:listitem> </asp:dropdownlist> </td> <td rowspan="1"> <asp:requiredfieldvalidator id="requiredcountry" runat="server" controltovalidate="dropdownlistselectcountry" errormessage="please select country." initialvalue="select country" cssclass="validationerror"></asp:requiredfieldvalidator> </td> </tr> <tr> <td class="auto-style2" rowspan="1"> </td> <td class="auto-style7" rowspan="1"> <asp:button id="submit" runat="server" text="button" /> </td> <td rowspan="1"> </td> </tr> </table> </div> </form> <script type="text/javascript" src="scripts/customscripts.js"></script> </body> </html>
Comments
Post a Comment