我有一个ListView和DropDownList(主要),并且在ListView的每一行内都有一个和一个文本框。全部在用户控件上,并在另一个usercontol上使用此用户控件(这里是要执行的操作。)(我们使用的是DNN)。 现在我想为dropdownlist添加事件处理程序,它将对SelectedIndexChanged作出反应。我想显示和隐藏其他下拉列表和文本框,具体取决于所选DropDrownList(主要)的特定值。 我无处可去。尽管有几次尝试。
筛选结果:& nbsp 评论: 使用的子集:& nbsp TAR状态:& nbsp
这样的代码
Public Sub ddlFindingsScreeningOutcome_SelectedIndexChanged(ByVal sender As Object,ByVal e As EventArgs) Dim ddl As DropDownList = CType(sender,DropDownList)
Dim item As ListViewItem = CType(ddl.NamingContainer, ListViewItem)
Dim txtFindingsComments As TextBox = CType(item.FindControl("txtFindingsComments"), TextBox)
Dim ddlFindingsTarStatus As DropDownList = CType(item.FindControl("ddlFindingsTarStatus"), DropDownList)
If Not ddl Is Nothing Then
If Not ddl.SelectedItem.Text = "Not Screened" Then
txtFindingsComments.Visible = True
ddlFindingsTarStatus.Visible = True
End If
Else
txtFindingsComments.Visible = False
ddlFindingsTarStatus.Visible = False
End If
End Sub