DropDownList二级联动 为何子级DropDownList 显示不出来啊 求助!(已解决)
全部的代码 DropDownList二级联动public void DataBind()
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["DNS"]);
string Sql = "select * from dictionary where projectid like '0%'";
SqlDataAdapter da = new SqlDataAdapter(Sql, con);
DataSet ds = new DataSet();
da.Fill(ds, "dictionary");
con.Close();
DropDownList2.DataSource = ds.Tables["dictionary"].DefaultView;
DropDownList2.DataTextField = "name";
DropDownList2.DataValueField = "projectid";
DropDownList2.DataBind();
}
protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["DNS"]);
string Sql1 = "select * from dictionary where zjid like '" + DropDownList2.SelectedValue + "%'";
SqlDataAdapter da = new SqlDataAdapter(Sql1, con);
DataSet ds = new DataSet();
da.Fill(ds, "dictionary");
con.Close();
DropDownList3.DataSource = ds.Tables["dictionary"].DefaultView;
DropDownList3.DataTextField = "name";
DropDownList3.DataBind();
}
为什么运行没效果啊,
这样的写有错吗?
[[it] 本帖最后由 lovexran 于 2008-4-15 09:54 编辑 [/it]]