我做了两个下拉列表:
部门:
<asp:DropDownList runat="server" id="BM" DataTextField="BMMC" />
二级部门:
<asp:DropDownList runat="server" id="SubBM" DataTextField="SubBMMC" />
下拉列表的数据在前面绑定,可是不知道怎么实现,请帮忙!!!
对于部门下拉列表的数据我是这样处理的:(请指教)
Dim mycommand1 As SqlCommand
mycommand1 = new SqlCommand("select BMMC from T_BM",myconn)
myconn.open()
Dim dr1 As SqlDataReader = mycommand1.ExecuteReader()
BM.DataSource = dr1
BM.DataBind()
myconn.close()
关于二级部门下拉列表的数据再这样写一遍的话总是有错误,本人是初学者请多多指教!!
部门:
<asp:DropDownList runat="server" id="BM" DataTextField="BMMC" />
二级部门:
<asp:DropDownList runat="server" id="SubBM" DataTextField="SubBMMC" />
下拉列表的数据在前面绑定,可是不知道怎么实现,请帮忙!!!
对于部门下拉列表的数据我是这样处理的:(请指教)
Dim mycommand1 As SqlCommand
mycommand1 = new SqlCommand("select BMMC from T_BM",myconn)
myconn.open()
Dim dr1 As SqlDataReader = mycommand1.ExecuteReader()
BM.DataSource = dr1
BM.DataBind()
myconn.close()
关于二级部门下拉列表的数据再这样写一遍的话总是有错误,本人是初学者请多多指教!!
并且加上
if is not me.postback then
end if
判断
可是总是显示不出来,请帮我看看呀!
Sub Page_Load(sender As Object, e As Eventargs)
If not IsPostBack
mycommand = new SqlCommand("select BMMC from T_BM",myconn)
myconn.open()
Dim dr1 As SqlDataReader = mycommand.ExecuteReader()
BM.DataSource = dr1
BM.DataBind()
myconn.close()
End If
End Sub
部门:<asp:DropDownList runat="server" id="BM" DataValueField="BMMC" OnSelectedIndexChanged="subbm_click" >
<asp:ListItem Value="00" Selected="True">请选择</asp:ListItem> </asp:DropDownList>
请再帮帮忙!!