我正在尝试放置一个 - 看起来 - 非常简单的网络用户控件
基本上我希望它基于属性呈现为下拉列表/复选框列表或单选列表,但也希望能够计算出选择的内容
我正在尝试以下操作 - 但似乎无法弄清楚如何附加到 listcontrol 的 selectedindexchanged 以便我可以设置选定的值它无助于我的 VB 不是很多但被迫使用它这个实例甚至没有给我事件的智能感知..
Public Options As List(Of Options)
Public ControlRenderType As ControlRenderType
Public IncludeFreeOption As Boolean
Public SelectedOptions As List(Of Options)
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim c As ListControl
Select Case (ControlRenderType)
Case STGLib.ControlRenderType.CheckBoxList
c = New CheckBoxList()
Case STGLib.ControlRenderType.DropdownList
c = New DropDownList()
Case STGLib.ControlRenderType.RadioButtonList
c = New RadioButtonList()
Case Else
Throw New Exception("No Render Type Specified")
End Select
For Each opt In Options
Dim li = New ListItem(opt.Description, opt.ID)
c.Items.Add(li)
Next
c.SelectedIndexChanged += ..?? or something
Page.Controls.Add(c)
End Sub
谁能解释一下-当然,我很有可能以完全错误的方式解决这个问题..
谢谢