怎么取到treeview 中checkbox选中的id值 本帖最后由 shikun125 于 2011-05-29 18:46:34 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 insertQXLB += t.ID + ","; protected void btn_Click(object sender, EventArgs e) { string insertQXLB = ""; foreach (TreeNode t in TreeView1.CheckedNodes) { if (t.Checked) { insertQXLB += t.id + ","; } } Common.Constant.Show(this.Page, insertQXLB);//弹出窗口 } TreeView生成的CheckBox好像没有id的吧…… 你是要获取数据库中的id值?如果是的话绑定的时候给value绑定id,text绑定你数据库中要显示的文本。另外一点foreach (TreeNode t in TreeView1.CheckedNodes)//这个代表的就是选中的复选框了 { if (t.Checked)//这里不用在判断了 { insertQXLB += t.Value + ","; } } foreach (Control c in this.rptOutList.Controls) { CheckBox cbx = (CheckBox)c.FindControl("checkbox1"); TextBox tbx = (TextBox)c.FindControl("tbxTableName"); if (cbx != null) { if (cbx.Checked == true) { BusinessTemporaryOutStorageExpireUnLockIM bisUnlockIM = new BusinessTemporaryOutStorageExpireUnLockIM(); bisUnlockIM.BillOutNo = tbx.Text.ToString().Trim(); } } } select 问题 求获取ASP的Image控件句柄的代码 这样的窗体怎么做? html基础问题 关于HtmlTextBoxControl 将参数值从 String 转换到 Int32 失败。 如何判断Label中文本的行数? 求.NET的项目需求文档 asp.net(c#)中如何统计Session呀? 谁有ActiveReports Professional Edition 的注册码呀,是六段注册码(CSDN下的)? 悬赏100分解决多表连接的问题! jquery防止重复提交、刷新和后退
protected void btn_Click(object sender, EventArgs e)
{
string insertQXLB = "";
foreach (TreeNode t in TreeView1.CheckedNodes)
{
if (t.Checked)
{
insertQXLB += t.id + ",";
}
}
Common.Constant.Show(this.Page, insertQXLB);//弹出窗口
}
如果是的话绑定的时候给value绑定id,text绑定你数据库中要显示的文本。
另外一点foreach (TreeNode t in TreeView1.CheckedNodes)//这个代表的就是选中的复选框了
{
if (t.Checked)//这里不用在判断了
{
insertQXLB += t.Value + ",";
}
}
{
CheckBox cbx = (CheckBox)c.FindControl("checkbox1");
TextBox tbx = (TextBox)c.FindControl("tbxTableName");
if (cbx != null)
{
if (cbx.Checked == true)
{
BusinessTemporaryOutStorageExpireUnLockIM bisUnlockIM = new BusinessTemporaryOutStorageExpireUnLockIM();
bisUnlockIM.BillOutNo = tbx.Text.ToString().Trim(); }
}
}