在我的应用程序中,我有一个文本框,下拉列表和一个复选框列表。现在,我希望在选择下拉项目时显示复选框列表。复选框列表中的列表取决于我从下拉列表中选择的项目。
答案 0 :(得分:0)
您可以使用Dropdownlist选择索引更改事件进行选择更改。以及选中列表框可见。
代码背后:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
If DropDownList1.SelectedIndex > 1 Then
CheckBoxList1.Visible = True
If DropDownList1.SelectedIndex = 2 Then
'Put Your Code Here
Else
'Put Your Code Here
End If
Else
CheckBoxList1.Visible = False
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
CheckBoxList1.Visible = False
End Sub
设计
<asp:DropDownList ID="DropDownList1" runat="server" Height="48px" Width="256px" AutoPostBack="true"OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" >