【发布时间】:2019-03-28 20:45:20
【问题描述】:
我在 asp.net 用户控制页面中使用 Telerik RadTextBox。
我在主内容页面内的Jquery 验证代码下方写了如下所示,我试图在用户控件中将 RadText 框 name 属性设置为静态,以便我可以在主内容页面中使用它。
用户控制页面
<telerik:RadTextBox ID="txtProductPrice" ClientID="txtProductPrice"
runat="server" ClientIDMode="Static" />
主内容页面:
$("#aspnetForm").validate({
rules: {
ctl00$ContentPlaceHolder1$ucUserInfoI$txtProductPrice: {
required: true,
number: true,
maxlength: 5
},
}
});
我使用动态生成的名称属性来验证文本框,看起来很难看。
由于 RadTexBox 在 UserControl 页面中,我无法在主要内容页面中使用带有UniqueID 的 RadTexBox,如下所示:
$("#aspnetForm").validate({
rules: {
<%=txtProductPrice.UniqueID %>:{
required: true,
number: true,
maxlength: 5
},
}
});
知道如何在主内容页面中使用带有UniqueID 的RadTexBox 吗?
任何帮助都会很棒。
【问题讨论】:
-
启用不显眼的验证?
-
“那么有什么简洁简洁的方法可以在主内容页面中使用 name 属性” ~ 你在问什么?插件的参数 必须 匹配实际呈现的
name属性。如果name属性不够简洁,那就得怪ASP了。
标签: asp.net .net telerik jquery-validate radtextbox