gridview 中的 dropdownlist列表后台绑定问题 如题 怎样对gridview 中的 dropdownlist的下拉表后台绑定非数据库绑定下拉显示 0123 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 GridView实例 非数据?那0123是什么东西 ID么? DropDownList1.DataSource = ds; DropDownList1.SelectedIndex=; DropDownList1.SelectedValue=;绑定就这样 先生,不是DataSource绑定的噢类似于 DropDownList1.Items.Insert(0,"他妈的")DropDownList1.Items.Insert(1,"他娘的")DropDownList1.Items.Insert(1,"他干妈的") 先生,不是DataSource绑定的噢类似于 DropDownList1.Items.Insert(0,"他妈的")DropDownList1.Items.Insert(1,"他娘的")DropDownList1.Items.Insert(2,"他干妈的") 第一点,你没有跟我说是datatable还是直接Insert吧。第二点,看到你的回帖,我真的不想回答这个问题。 非常抱歉哈哈是insert其实 我是页面上 一个dropdownlist1 一个gridview 里面的dropdownlist2通过 dropdownlist1 选项 改变 gridview里的dropdownlist2 你的DropDownList1在gridview 中你要先通过这个找到该对象DropDownList ddl=(DropDownList)this.Gridview1.FindControl("下拉框的Id名称");ddl.Items.Insert(0,new ListItem("显示值","值"));ddl.Items.Insert (1,new ListItem("显示值","值"));这样就可以给你的GridView中的DropDownList赋值了希望可以帮到你,你试下 如果是这样也是一样的 只要你将你的DropDownList1中选中的值给定Dropdownlist2作为查询的添加就可以了 赋值的话和上面的是一样的 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList DropDownList1 = (DropDownList)e.Row.FindControl("DropDownList1"); DropDownList1.Items.Insert(0,new ListItem ("","0")); }} Dropdownlist1在 Gridview 外的提示 未将对象设置到实例噢 DropDownList1.DataSource = ds.Tables[0];DropDownList1.SelectedIndex="Name";DropDownList1.SelectedValue="Value";这样应该可以。 global namespace 高手帮忙,近来看看 简单问题帮帮忙 将一内网网站发布到公网,数据库连接串里的数据库地址该写公网地址还是内网地址啊? Response.Write里的Script问题两则求解 在asp.net中怎样使用复选框 asp1.1升级到2.0出的问题 使用asp.net如何连接到数据库的表呢? 如何隐藏table? .net1.1无法卸载 求一个正则表达式 asp.net 问题:我用的是开源的作业调度框架 - Quartz.NET来做定时任务不执行
DropDownList1.DataSource = ds;
DropDownList1.SelectedIndex=;
DropDownList1.SelectedValue=;绑定就这样
DropDownList1.Items.Insert(0,"他妈的")
DropDownList1.Items.Insert(1,"他娘的")
DropDownList1.Items.Insert(1,"他干妈的")
DropDownList1.Items.Insert(0,"他妈的")
DropDownList1.Items.Insert(1,"他娘的")
DropDownList1.Items.Insert(2,"他干妈的")
第二点,看到你的回帖,我真的不想回答这个问题。
非常抱歉
哈哈
是insert
其实 我是页面上 一个dropdownlist1 一个gridview 里面的dropdownlist2
通过 dropdownlist1 选项 改变 gridview里的dropdownlist2
DropDownList ddl=(DropDownList)this.Gridview1.FindControl("下拉框的Id名称");
ddl.Items.Insert(0,new ListItem("显示值","值"));
ddl.Items.Insert (1,new ListItem("显示值","值"));
这样就可以给你的GridView中的DropDownList赋值了希望可以帮到你,你试下
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList DropDownList1 = (DropDownList)e.Row.FindControl("DropDownList1");
DropDownList1.Items.Insert(0,new ListItem ("","0"));
}
}
提示 未将对象设置到实例噢
DropDownList1.SelectedIndex="Name";
DropDownList1.SelectedValue="Value";
这样应该可以。