我可以使用Jquery设置ValidationExpression吗?
我的验证如下: -
<asp:RegularExpressionValidator ID="regExpAge" runat="server" ControlToValidate="txtAge"
ErrorMessage="Please Enter Valid Age" ForeColor="Red" ValidationExpression="^\d{1,2}$"
ValidationGroup="sub" Display="Dynamic" ></asp:RegularExpressionValidator>
我使用javascript检查此页面中的查询字符串值: -
$(document).ready(function () {
/* Get Query String Value */
var vals = new Object();
var qs = location.search.substring(1, location.search.length);
var args = qs.split("&");
for (var i = 0; i < args.length; i++) {
var nameVal = args[i].split("=");
var temp = unescape(nameVal[1]).split('+');
nameVal[1] = temp.join(' ');
vals[nameVal[0]] = nameVal[1];
}
var ItemId = vals["ID"];
if (ItemId == 3)
{
//Set validation expression for regExpAge as :- ^(0?[1-9]) || (1[0-2])$
}
});
任何解决方案?请帮帮我。