我现在要用两个dropdownlist来做,怎么实现联动呢?
淘宝新到货: http://shop36082390. 电脑及配件/杀毒U盘/移动硬盘/减肥产品/切苹果器/剥蒜器/个性烟灰缸/装饰彩灯/雨伞/女包//手机座/极品铁观间茶叶/五层布衣柜/三洋/日立投影机
QQ:410243392 (常用)
绑定到一起:
string sqlstr = "select typename as 'aaa' from type union select productname as 'aaa' from list";
SqlConnection myconn = new ...........
SqlDataAdapter da = new SqlDataAdapter(sqlstr,myconn);
DataSet ds = new DataSet();
da.Fill(ds);
this.DropDownList1.DataSource = ds;
this.DropDownList1.DataTextField = "aaa";
this.DropDownList1.DataValueField = "aaa";
this.DropDownList1.DataBind();
分开做.你就在第一个的DropDownList的SelectedIndexChanged 事件里面写上相应的代码就行了.
这个功能实现了,能实现联动了,但我的product表中还有一个pro_id呢,
当我插入数据的时候pro_id为空值,
怎么使它也能动态的插入到product表中呢?