datagrid模板中选择第一个dropdownlist后根据第一个的值绑定第二个dropdownlist模板的值

a791223 a791223 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
想实现这样的功能,选择第一个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

...全文
评论 16
收藏 已收藏
分享
返回顶部
a791223
.NET社区 62,271 成员 668,968 内容