在TabPanel中从客户端引用控件的最佳方法是什么?我尝试过使用jQuery和javascript都失败了。我已经厌倦了使用find方法,但仍然没有运气...... SchoolSectionID指的是我的一个TabPanel控件中的div元素。
for(var a = 1; a< 4; a ++){ var SelectControlID =“”; var HiddenControlID =“”; var BehaviorID =“”; var SectionIdentifer = a; var SchoolSectionID =“SchoolSection”+ a +“”;
/* Retrieve all select list controls from this panel. */
var selectElements = $("#" + SchoolSectionID + "").find("select");
alert(selectElements.length);
for (var i = 0; i < selectElements.length; i++) {
SelectControlID = selectElements[i].id.split('_')[2];
alert(SelectControlID);
BehaviorID = "SchoolTypeID" + a + "";
InitControl(SelectControlID);
switch (i) {
case 0:
LoadDegreeStatus(SelectControlID);
HiddenControlID = "_hndSchoolStatus" + a + "";
RegisterOnSelectedItemEvent(SelectControlID, HiddenControlID);
break;
case 1:
HiddenControlID = "_hndSchoolYear" + a + "";
LoadSchoolYears(SelectControlID, HiddenControlID);
RegisterOnSelectedItemEvent(SelectControlID, HiddenControlID);
break;
case 2:
HiddenControlID = "_hndSchoolType" + a + "";
LoadSchoolTypes(SelectControlID);
RegisterOnChangeEvent(SelectControlID, BehaviorID, SectionIdentifer);
RegisterOnSelectedItemEvent(SelectControlID, HiddenControlID);
break;
case 3:
HiddenControlID = "_hndDiploma" + a + "";
LoadDiplomas(SelectControlID);
RegisterOnSelectedItemEvent(SelectControlID, HiddenControlID);
break;
default:
}
}
} STATUT: ANNEE: ETABLISSEMENT: 文凭:
答案 0 :(得分:0)
通过ClientID访问Javascript中的.NET控件。
var dotNetControl = $('<% control.ClientID %>');