尝试锁定自定义控件,但在页面中有多个控件时出现问题
Trying to lock a custom control, but having problems when more than one of the control in the page
我有一个自定义控件,我将其加载到页面上三次。
自定义控件由文本框和自定义日期选取器控件组成。
我正在尝试锁定所有人的日期选择器控件。
我在控件中尝试了以下代码。
$(document).ready(function() {
debugger;
var mySelector = '#' + $('[id$=''_SignatureNonPoliceControl'']', $(this)).attr('id');
$(mySelector.replace('_SignatureNonPoliceControl', '_SignatureDatePicker_DatePickerControl')).BaseControlPlugin(BaseControlMethodsEnum.SetLocked, true);
});
但是,这只会锁定第一个并执行三次。
我的控件是这样设置的
<uc8:SignatureCaptureNonPolice ID="DetaineeSignature" runat="server" Caption = "Person's Signature to Comments " RetainValueWhenDisabled="true" />
<uc1:GenericDropDownList Caption="Reason For Not Signing " ID="DetaineeReasonNotSignedGenericDropDownList" runat="server" />
<uc8:SignatureCaptureNonPolice ID="AppropriateAdultSignature" runat="server" Caption = "Appropriate Adults<br />Signature to Comments " RetainValueWhenDisabled="true" />
<uc8:SignatureCaptureNonPolice ID="InterpreterSignature" runat="server" Caption = "Interpreter's Signature<br />to Comments " RetainValueWhenDisabled="true" />
我必须使用 $(这个)吗? 我对此很陌生。
帮助!
谢谢
凯文。
您的日期选择器有公共类吗?你可以选择它:
$('.className')
另一种选择是在一个选择器中用逗号分隔您的所有 ID:
$('#firstID,#secondID,#thirdID')
然后我假设您想对它们应用锁定的类?
$('.className').addClass("locked");
你可以通过做这样的事情来轻松检查这个逻辑:
if (this.hasClass("locked") {
// this is locked.
}
在此处阅读有关选择器的更多信息:http://api.jquery.com/category/selectors/
相关文章:
- 创建服务器控件.创建问题
- 从谷歌地图自定义控件打开离子模态时遇到问题
- Javascript在每个有问题的控件上输出一条错误消息
- 尝试锁定自定义控件,但在页面中有多个控件时出现问题
- Silverlight 5 xaml 视图中的 Web 浏览器控件使用某些 JavaScript 时出现问题
- winforms Web浏览器控件中的JavaScript访问问题
- Phaser框架中虚拟控件类的问题
- Asp.Net树视图控件折叠后未选中子复选框.如何处理这个问题
- 在一个页面上使用多个jQuery UI控件实例有问题.手风琴控件的多种用途
- c#控件的Jquery附加问题
- 错误的定时问题,Telerik RadEditor控件's客户端事件和jquery's on page
- sedragon自定义控件,带有onClick事件处理程序:IE中的问题
- 使用WebBrowser控件以编程方式登录网站时出现问题
- 内网存在IE8 ActiveX控件问题
- 基于asp.net复选框的启用和禁用按钮控件的问题
- 在Javascript中获取asp控件的ClientID的问题
- 用户控件c#中隐藏字段的问题
- Windows商店js应用程序导航控件导致数据绑定问题
- 动态数字表单控件问题
- 构建多选用户控件时出现问题