日期:2014-05-17  浏览次数:20437 次

这种下拉列表框效果是怎么实现的!

给个列子好吗?

------解决方案--------------------
前台:  <asp:DropDownList ID="Drop_duty" runat="server">
                </asp:DropDownList>

后台:/// <summary>
        /// 绑定分类下拉框
        /// </summary>
        private void DropTree()
        {
            Drop_duty.Items.Clear();
            Drop_duty.Items.Add(new ListItem("请选择", "0"));
            try
            {
                DataTable dttype = new BLL.cp_newstype().GetList(0, "newst_pid=0 and newst_type=1", "newst_order asc,newst_id desc").Tables[0];
                for (int i = 0; i < dttype.Rows.Count; i++)
                {
                    Drop_duty.Items.Add(new ListItem(dttype.Rows[i]["newst_name"].ToString(), dttype.Rows[i]["newst_id"].ToString()));
                    DataTable dtpid = new BLL.cp_newstype().GetList(0, "newst_pid=" + dttype.Rows[i]["newst_id"].ToString() + " and newst_type=1", "newst_order asc,newst_id desc").Tables[0];
                    for (int j = 0; j < dtpid.Rows.Count; j++)
                    {
                        Drop_duty.Items.Add(new ListItem(" " + "
------解决方案--------------------
--" + dtpid.Rows[j]["newst_name"].ToString(), dtpid.Rows[j]["newst_id"].ToString()));
                    }
                }
            }
            catch
            {
                ;
  &n