关于JS获取checkboxlist值的问题,请各位大虾帮忙,先谢了
我在datalist的模板里套用了checkboxlist,而我需要在前台用JS获取checkboxlist的值,请问各位大虾我应该如何做?
这是绑定checkboxlist的代码
protected void dltVote_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
CheckBoxList cbl = (CheckBoxList)e.Item.FindControl("cblVote");
Label lab = (Label)e.Item.FindControl("labVoteId");
this.DB.Open();
SqlCommand cmd = new SqlCommand("select id,voteid,title from voteContent where voteid=" + lab.Text.ToString(), this.DB.con);
SqlDataReader rs = cmd.ExecuteReader();
if (rs.HasRows)
{
cbl.DataSource = rs;
cbl.DataTextField = "title";
cbl.DataValueField = "id";
cbl.DataBind();
}
rs.Close();
rs.Dispose();
cmd.Dispose();
this.DB.Close();
}
}
}
请各位大虾帮忙看一下,谢啦~~~