求助:怎样取到dropdownlist的值?
第一个dropdownlist是数据库绑定的。相关代码如下:<td bgcolor="#FFFFFF"><% DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue(DataSet1.FieldValue("ID", Nothing) )) %><asp:DropDownList ID="DropDownList1" runat="server" DataTextField="years" DataValueField="ID" DataSource='<%# DataSet1.DefaultView %>'> </asp:DropDownList>
年
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem value="0">---不限---</asp:ListItem>
<asp:ListItem value="">1</asp:ListItem>
<asp:ListItem value="2">2</asp:ListItem>
<asp:ListItem value="3">3</asp:ListItem>
</asp:DropDownList>
....
<script language="vb" runat="server">
Sub click(sender as object,e as eventargs)
Dim MyConnection as OLEDBConnection
Dim MyCommand,MyCommand2 as OleDbCommand
Dim s,sexs,ages,nameID,daName As String
Dim i As Integer
daName = TextBox1.Text
MyConnection = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("..\source\dabo.mdb"))
MyCommand=new OleDbCommand("select daName from daInfo where daName='"+TextBox1.text+"'",MyConnection)
MyConnection.open()
If RadioButton1.checked Then
sexs="男"
Else If RadioButton2.checked Then
sexs="女"
End If
If (Page.IsPostBack) Then
DropDownList2.Items(i).Selected Then
ages = DropDownList2.Items(i).Text
Else
ages = "2ee3"
End If