Board index » Visual Studio » How To: Dropdown value for subclassed property
|
Alexandr
|
How To: Dropdown value for subclassed property
Visual Studio24
Hello, I'm trying to subclass a web page button to add a property for security. The sub-classed web form will read security and cycle though the objects on the page to decided what needs to be disabled. After I got it up and running, I thought it would be much nicer if it had a dropdown list of the securities available rather then inputting a number. Any suggestions or pointers would be appreciated. This is what I tried that didn't work... Imports System.ComponentModel Imports System.Web.UI Imports System.Drawing Imports System.Drawing.Color Imports System.Web.UI.WebControls <ToolboxBitmap(GetType(System.Web.UI.WebControls.Button))>_ Public Class Button Inherits System.Web.UI.WebControls.Button Private intSecurity As Int16 = 0 Private ddlSecurityList As DropDownList <Description("Controls what permission affects the button."), _ Category("Behavior")>_ Public Property DisabledBy() As DropDownList Get Return ddlSecurityList End Get Set(ByVal Value As DropDownList) ddlSecurityList.SelectedIndex = Value.SelectedIndex intSecurity = ddlSecurityList.SelectedItem.Value End Set End Property Public Sub New() MyBase.New() Dim mySortedList As New System.Collections.SortedList() Dim Item As DictionaryEntry mySortedList("0") = "None" mySortedList("1") = "Read/Visable" mySortedList("2") = "Write/Enabled" mySortedList("3") = "Edit" mySortedList("4") = "Delete" For Each Item In mySortedList Dim newListItem As New System.Web.UI.WebControls.ListItem() newListItem.Text = Item.Value newListItem.Value = Item.Key ddlSecurityList.Items.Add(newListItem) Next End Sub End Class - |
