本文介绍了将选中复选框列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hii在我的应用程序中基于下拉项目选择复选框列表填写一些项目。填写项目后,将检查所有项目。
请与我分享任何想法。
i我正在使用此代码
Hii in my application based on drop down item selection check box list fill some items.after fill the items all the items will be checked .
please share any idea to me.
i am using this code
companyname = Droppeersnlcompanylist.SelectedItem.ToString();
string state = droppeersstate.SelectedItem.Text; ;
string lob = droppeerslob.SelectedItem.Text;
string top = Droppeerstop.SelectedItem.Text;
dalclasss objDAL = new dalclasss();
DataTable dt = new DataTable();
dt = objDAL.Getdata(companyname, state, lob, top);
checkboxsnlcompanylist.Items.Clear();
//Session["peers"] = dataTable;
checkboxsnlcompanylist.DataSource = dt_peers;
checkboxsnlcompanylist.DataTextField = dt_peers.Columns[0].ToString();
checkboxsnlcompanylist.DataValueField = dt_peers.Columns[0].ToString();
checkboxsnlcompanylist.DataBind();
for (int i = 0; i < checkboxsnlcompanylist.Items.Count; i++)
{
checkboxsnlcompanylist.SelectedItem.Selected = true;
}
请与我分享任何想法
please share any idea to me
推荐答案
for (int i = 0; i < checkboxsnlcompanylist.Items.Count; i++)
{
checkboxsnlcompanylist.Items[i].Selected = true;
}
这篇关于将选中复选框列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!