TABLE??数据库中的TABLE?...SQL="Select 产品类别 from 产品类别Table"....xxx.FillDataSet(ds,"类别")...
DropDownList1.DataSource=ds.Tables("类别").DefaultVIew
DropDownList1.DataBind()....
=============
<asp:DropDownList id="DropDownList1" ..>
////////////
不知道行不行。。你试试 ?呵呵,我估计可以~~

解决方案 »

  1.   

    代码片断:sub page_load(sender as object,e as eventargs)
    if not ispostback then
    bindParentDrop()
    dim ParentNodeId as string=drop1.SelectedItem.value
    bindChildNode(ParentNodeId)
    bindXML()
    end if
    end subsub bindXML()
    Dim xmlds As DataSet=new dataset()
     xmlds.ReadXml(Server.MapPath("database\Corpname.xml"))
     drop3.DataSource=xmlds
     drop3.DataBind()
    end sub
    sub bindParentDrop()
    dim ds as dataset=new dataset()
    dim conn as OledbConnection=New OledbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data source="&server.mappath("database\Mytree.mdb"))
    dim mycommand as oledbdataadapter=new oledbdataadapter("select * from tree where TreeNode='-1' order by NodeNumber desc",conn)
    conn.open()
    mycommand.fill(ds)
    drop1.datasource=ds.tables(0).defaultview
    drop1.databind()
    end sub
    '=============得到选择的父节点====================
    sub OnDropChanged(sender as object,e as eventargs)
    dim ParentNodeId as string=drop1.SelectedItem.value
    '=============绑定子节点选择框
    bindChildNode(ParentNodeId)
    end sub
    '====================================
    sub bindChildNode(ParentNodeId as string)
    dim ds as dataset=new dataset()
    dim conn as oledbconnection
    conn=new oledbconnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("dATABASE\MYTREE.mdb"))
    dim mycommand as oledbDataAdapter
    dim selstr as string="select * from tree where TreeNode='"+ParentNodeId+"' order by NodeNumber desc"
    mycommand=new oledbDataAdapter(selstr,conn)
    conn.open()
    mycommand.fill(ds)
    drop2.datasource=ds.tables(0).defaultview
    drop2.databind()
    end sub
      

  2.   

    当然可以,所有的空间都可以动态生成,动态设定值的,举个简单例子:
    myButton=new Button();
    myButton.Text="ytr";
    myButton.Location=new System.Drawing.Point(100,100);
      

  3.   

    动态添加item
    DropDownList.Items.Add(new ListItem(yourText,yourValue));
      

  4.   

    按照yxrj的方法就可以啊!
    ListItem item = new ListItem(...);
    DropDownList1.Items.Add(item);
    ...