protected void ListBox2_TextChanged(object sender, EventArgs e) { PlaceHolder4.Visible = true; ListBox1.ClearSelection(); ListBox3.ClearSelection(); ddeven.Items.Clear(); int value = int.Parse(ListBox2.SelectedItem.Value); if (value == 2) { bindlist(value.ToString()); PlaceHolder1.Visible = true; PlaceHolder2.Visible = false; PlaceHolder3.Visible = false; ddeven.Items.Insert(0, new ListItem("显示二级菜单", "0")); ddeven.Items.Insert(1, new ListItem("点击事件", "click")); ddeven.Items.Insert(2, new ListItem("链接地址", "url")); } else { ddeven.Items.Insert(0, new ListItem("点击事件", "click")); ddeven.Items.Insert(1, new ListItem("链接地址", "url")); Cms.BLL.wx_menu wm = new Cms.BLL.wx_menu(); DataTable dt = wm.GetList("id=" + value).Tables[0]; if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; string type = dr["type"].ToString(); if (type == "click") { ddeven.SelectedValue = "click"; PlaceHolder1.Visible = false; PlaceHolder2.Visible = true; PlaceHolder3.Visible = false; tbkey.Text = dr["keys"].ToString(); tinfo.Value = dr["info"].ToString(); tcontent.Value = dr["content"].ToString(); } else { ddeven.SelectedValue = "url"; PlaceHolder1.Visible = false; PlaceHolder2.Visible = false; PlaceHolder3.Visible = true; tburl.Text = dr["url"].ToString(); } } } tbname.Text = ListBox2.SelectedItem.Text; }
protected void ListBox4_SelectedIndexChanged(object sender, EventArgs e) { ListBox1.ClearSelection(); ListBox2.ClearSelection(); ListBox3.ClearSelection(); ListBox5.ClearSelection(); ListBox6.Items.Clear(); String selection = ListBox4.SelectedItem.Text; System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(); conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data source= C:\Users\OK\Documents\Ecafe.accdb"; conn.Open(); String my_querry1 = "select Item from Items where Type = '" + selection + "'"; OleDbCommand cmd1 = new OleDbCommand(my_querry1, conn); var dr1 = cmd1.ExecuteReader(); // MessageBox.Show("Query executed"); while (dr1.Read()) { ListBox6.Items.Add(dr1[0].ToString()); //MessageBox.Show(dr1[1].ToString()); } Label2.Text = selection; ListBox6.Visible = true; ListBox7.Visible = true; ListBox8.Visible = true; ListBox9.Visible = true; Label1.Visible = true; Label2.Visible = true; Label3.Visible = true; Label5.Visible = true; Label6.Visible = true; Label7.Visible = true; Label8.Visible = true; Label9.Visible = true; Label10.Visible = true; TextBox2.Visible = true; Button1.Visible = true; Button2.Visible = true; }