很多时候,我们都需要打开另一个窗口选择数据,窗口利用脚本返"回编号+名称",编码用HiddenField临时存放值,名称使用ASPxButtonEdit,在写BottonClick脚本实现,但在EditForm中,控件的ID是随着位置变化的,不能在脚本代码中直接引用ID,需要采用如下方法:
function(s, e) {
var returnValue= window.showModalDialog("/CEclipse/UI/Section/SelectDepartment.aspx","","dialogWidth:340px;dialogHeight:490px;status:'no'");
if (returnValue!=null)
{
var id=returnValue.substring(0,returnValue.indexOf("+"));
var name=returnValue.substring(returnValue.indexOf("+")+1);
s.SetText(name);
var hidID=s.name.substring(0,s.name.lastIndexOf("_")+1)+"HiddenField2";
var hidd=document.getElementById(hidID);
hidd.setAttribute("value",id);
}
}