0
在一個頁面我有兩個單選按鈕,選擇一個我會通過使用稱爲'人'和'組織'的類在這個頁面顯示一些控件。此外,我想檢查用戶在輸入文本控件中輸入正確的數據。我如何在客戶端驗證數據? 例如:如何禁用和啓用RequiredFieldValidator控件與jquery
<input runat="server" id="txtnationalid" maxLength="10" name="txtnationalid" class='person ltr glow-onfocus customerCode required number' dir="ltr" />
<asp:RequiredFieldValidator Display="Dynamic" runat="server" ID="txtcodecv1" ErrorMessage="it can not be null" ControlToValidate="txtnationalid" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ValidationExpression="[0-9]{10}" Display="Dynamic" runat="server" id="txtcodev2" ErrorMessage="it's not in correct format" ControlToValidate="txtnationalid" ></asp:RegularExpressionValidator>
<input runat="server" id="txteconomiccode" maxLength="15" name="txteconomiccode" class='organization ltr glow-onfocus customerCode required number' dir="ltr" />
<asp:RequiredFieldValidator Display="Dynamic" runat="server" id="txtcodecv3" ErrorMessage="economiccode required" ControlToValidate="txteconomiccode"></asp:RequiredFieldValidator>
http://stackoverflow.com/questions/9704039/enable-disable -aspvalidators-using-jquery#answer-9803857 – 2013-03-04 12:25:41