日期:2014-05-20  浏览次数:20700 次

JS获得服务器控件CheckBoxList的值
我的绑定了一个CheckboxList,我想在Js里根据我所得到的数据库里的值和它的值比对,然后把该选中的选中,我的代码是 var probUse = arr2[13].split(',');
  var chkObject=$get(preid+"ckProbUse");
  var chkInput =chkObject.getElementsByTagName("INPUT");
  for(var j=0;j<probUse.length;j++){
  for(var i=0;i<chkInput.length;i++)
  {
  if(probUse[j]==chkInput[i].Value)
  {
  chkInput[i].checked=true;
  alert(chkInput[i].innerText);
  }
  }
}
arr[13]的值就是像1,2,3,4,5这样的字符串数组,但是我写的这个chkInput[i].Value, value未定义。
后台的绑定是 
private void BindProbUse()
  {
  Rhky.Ipaper2008.SubjectManage.BLL.SubjectInfo subjectinfo = new Rhky.Ipaper2008.SubjectManage.BLL.SubjectInfo(this.SubjectID);
  using (DataSet ds = subjectinfo.GetProbUseList())
  {
  this.ckProbUse.DataSource = ds.Tables[0].DefaultView;
  this.ckProbUse.DataTextField = "IndexName";
  this.ckProbUse.DataValueField = "IndexCode";
  this.ckProbUse.DataBind();
  }
  }请各位大侠帮帮忙,在线等!!!谢谢

------解决方案--------------------
chkInput[i].checked='checked';