我有ASP:Panel最初可见false,并且有另一个单选按钮列表,其值为yes或no 点击“是”,我的面板显示为真, 现在我的问题是,当我点击是我的面板是可见的,但在jquery我无法找到放在面板内的控制
Jquery
jQuery("[id$='p_lt_ctl01_ContentPageplaceholder_p_lt_ctl13_editabletext1_ucEditableText_widget1_ctl00_chkVndr']").change(function () {
debugger;
var chkval = jQuery('input[id*=chkVndr]:checked').val();
if (chkval == "Yes") {
alert(12346);
document.getElementById('<%= txtDtOfServ.ClientID %>').keypress(function (event) {
// jQuery("#p_lt_ctl01_ContentPageplaceholder_p_lt_ctl13_editabletext1_ucEditableText_widget1_ctl00_txtDtOfServ_dtPicker_txtDateTime").keypress(function (event) {
event.preventDefault();
});
}
else {
jQuery("#p_lt_ctl01_ContentPageplaceholder_p_lt_ctl13_editabletext1_ucEditableText_widget1_ctl00_txtDtOfServ_dtPicker_txtDateTime").keypress(function (event) {
event.preventDefault();
});
}
});
控制结构
<asp:Panel ID="Vendordtl" runat="server" Visible="false">
<my:myDateTimeControl ID="txtDtOfServ" runat="server" IsRequired="true" NeedsValidation="true" EditTime="false" DisplayNow="false" />
<asp:Pane/>
答案 0 :(得分:0)
由于DateTimeControl
是该小组的孩子,因此您必须首先浏览该小组。
尝试类似:
document.getElementById('<%= Vendordtl.FindControl("txtDtOfServ").ClientID %>')