Dropdownlist问题??在线等
Dropdownlist1.DataSource = ds;
Dropdownlist1.DataTextField = "province ";
Dropdownlist1.DataValueField = "leter ";
Dropdownlist1.DataBind();
我帮定以后默认是第一条怎么能让它默认为空就是不选中状态
------解决方案--------------------再加一个item,Index设置为-1,程序取值的时候判断一下
------解决方案--------------------ListItem itemNull = new ListItem();
itemNull.Text = string.Empty;
itemNull.Index = -1;
ddl.Items.Add(itemNull);
------解决方案--------------------ListItem itemNull = new ListItem();
itemNull.Text = string.Empty;
itemNull.Value = -1;
ddl.Items.Add(itemNull);
应该是这样,sorry
------解决方案--------------------ddl.Items.Insert(0,new ListItem( " ", "-1 "));
------解决方案--------------------都行
------解决方案--------------------Dropdownlist1.Item.add(new Item( "... ", "-1 "));
Dropdownlist1.DataSource = ds;
Dropdownlist1.DataTextField = "province ";
Dropdownlist1.DataValueField = "leter ";
Dropdownlist1.DataBind();
------解决方案--------------------ListItem itemNull = new ListItem();
itemNull.Text = "请选择... ";
itemNull.Index = -1;
ddl.Items.Add(itemNull);
------解决方案--------------------一般这样比较好
ddl.Items.Insert(0,new ListItem( "请选择 ", "-1 "));