TABLE??数据库中的TABLE?...SQL="Select 产品类别 from 产品类别Table"....xxx.FillDataSet(ds,"类别")...
DropDownList1.DataSource=ds.Tables("类别").DefaultVIew
DropDownList1.DataBind()....
=============
<asp:DropDownList id="DropDownList1" ..>
////////////
不知道行不行。。你试试 ?呵呵,我估计可以~~
DropDownList1.DataSource=ds.Tables("类别").DefaultVIew
DropDownList1.DataBind()....
=============
<asp:DropDownList id="DropDownList1" ..>
////////////
不知道行不行。。你试试 ?呵呵,我估计可以~~
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
myButton=new Button();
myButton.Text="ytr";
myButton.Location=new System.Drawing.Point(100,100);
DropDownList.Items.Add(new ListItem(yourText,yourValue));
ListItem item = new ListItem(...);
DropDownList1.Items.Add(item);
...