轻松实现无刷新三级联动菜单[VS2005与AjaxPro]

作者:凯旋网络来源:凯旋网络
as txt,id as vol 如果是sql ser 可以用 =
        //页面获取的 列名称 必须跟这个一同样 而且区分大小写 一般都是这个地方容易疏忽了
        //所以二级分类没变化
        string sql = @"select cname as txt,id as vol from webclass where parentid=" + cid;
        try
        {
            return getDs(sql);
        }
        catch
        {
            //throw;
            return null;
        }
    }
   

    /**//// <summary>
    /// 返回一个DataSet
    /// </summary>
    /// <param name="SQL"></param>
    /// <returns></returns>
    public DataSet getDs(string SQL)
    {
        OleDbConnection conn = myConn();
        DataSet Ds = new DataSet();
        OleDbDataAdapter Da = new OleDbDataAdapter(SQL, conn);
        try
        {  
            Da.Fill(Ds);
            return Ds;
        }
        catch
        {
            return null;
            //throw;
        }

    }
    /**//// <summary>
    /// //数据绑定
    /// </summary>
    private void BindDc()
    {
        //第一个
        string sql = @"select * from webclass where Parentid=0";
        ddl1.DataSource = getDs(sql);
        ddl1.DataTextField = "cname";
        ddl1.DataValueField = "id";
        ddl1.DataBind();
        if (ddl1.DataSource != null) ddl1.Attributes.Add("onchange", "showNext(this.options[selectedIndex].value,''ddl2'');");

      
        //可以先判断 DropDownList.SelectedItem.Value
        //第二个
 &nbs

  • 广告推荐