datagrid模板中选择第一个dropdownlist后根据第一个的值绑定第二个dropdownlist模板的值
想实现这样的功能,选择第一个dropdownlist里的值,根据它的值绑定第二个dropdownlist模板的值
第一个dropdownlist绑定的代码如下:
<ItemTemplate>
<asp:DropDownList id="gsmc" runat="server" Width="138px" DataSource="<%# yggs() %>" DataTextField="gsjc" DataValueField="gsbh"></asp:DropDownList>
</ItemTemplate>
Public Function yggs()
Dim strsql As String = "select gsjc,gsbh from ld_gs where gslx=0 order by gsbh"
objadapter.SelectCommand = New OracleCommand(strsql, objconnection)
objadapter.Fill(objdataset, "tmpgs")
Dim pubs As New DataSet
Dim comTable As New DataTable("comTable")
Dim comgsbh As New DataColumn("gsbh")
Dim comgsjc As New DataColumn("gsjc")
Dim comRow As DataRow
comTable.Columns.Add(comgsbh)
comTable.Columns.Add(comgsjc)
Dim i As Integer
Dim l As Integer
Dim count As Integer = 0
Dim x As Integer
Dim y As Integer
For x = 0 To objdataset.Tables("tmpgs").Rows.Count
comRow = comTable.NewRow
If x = 0 Then
comRow("gsbh") = ""
Else
comRow("gsbh") = objdataset.Tables("tmpgs").Rows(x - 1).Item("gsbh")
comRow("gsjc") = objdataset.Tables("tmpgs").Rows(x - 1).Item("gsjc")
End If
comTable.Rows.Add(comRow)
Next
pubs.Tables.Add(comTable)
Return pubs.Tables("comTable").DefaultView
End Function