联动问题,高手请教
两个下拉列表,第二个总是取不到值,代码如下
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DllBing();
}
}
private void DllBing()
{
string strConn = System.Configuration.ConfigurationSettings.AppSettings[ "2ValorCnsDB "].ToString();
SqlConnection conPubs = new SqlConnection(strConn);
conPubs.Open();
SqlDataAdapter da = new SqlDataAdapter( "select * from VIEW_ShowRoom ", conPubs); //PMID= ' " + Session[ "pmID "].ToString() + " ' ", conPubs);
DataSet table = new DataSet();
da.Fill(table);
conPubs.Close();
pm.DataSource = table;
pm.DataTextField = "pModel ";
pm.DataValueField = "PMID ";
pm.DataBind();
// //pm.Items.Insert(0, "Please select ");
}
protected void pc_SelectedIndexChanged(object sender, EventArgs e)
{
string strConn = System.Configuration.ConfigurationSettings.AppSettings[ "2ValorCnsDB "].ToString();
SqlConnection conPubs = new SqlConnection(strConn);
conPubs.Open();
SqlDataAdapter da = new SqlDataAdapter( "select * from VIEW_ShowRoom where pcID= ' " + pc.SelectedValue + " ' ", conPubs); //PMID= ' " + Session[ "pmID "].ToString() + " ' ", conPubs);
DataSet table = new DataSet();
da.Fill(table);
conPubs.Close();
pm.DataSource = &nb