怎样在dropdownlist控
如果控件要加载数据表中的一个字段,可以用适配器填充数据集,在采用数据集作为数据源。加在Form_Load()
if Not PostBack then
SqlDataAdapter1。 Fill(dataset11,"country")
DropDownList1。DataSource=dataset11
DropDownList1。DataValueField="code"
DropDownList1。 DataTextField="shorname"
DropDownList1。DataBind()
DropDownList1。SelectedIndex=0
end if。全部
如果控件要加载数据表中的一个字段,可以用适配器填充数据集,在采用数据集作为数据源。加在Form_Load()
if Not PostBack then
SqlDataAdapter1。
Fill(dataset11,"country")
DropDownList1。DataSource=dataset11
DropDownList1。DataValueField="code"
DropDownList1。
DataTextField="shorname"
DropDownList1。DataBind()
DropDownList1。SelectedIndex=0
end if。收起