[2005] User control property to have a drop down list of values
I am developing a web user control and have a property exposed of type object. What I want is that when this user control is placed on a web form this property will pick up all the textboxes and give the user an option to choose from those values. Something very similar to what we've in CompareValidator where we get to choose the name of the control to compare etc. Any ideas where I should start from? Thanks.
Re: [2005] User control property to have a drop down list of values
Create an Enum with the properties
vb Code:
Public Enum PropertiesEnum
Item1
Item2
Item3
End Enum
Public Property PropertyTest() As PropertiesEnum
Get
Dim intValue As Integer = Cint(ViewState("PropertyTest"))
Return intValue
End Get
Set (byval value As PropertiesEnum)
ViewState("PropertyTest") = value
End Set
Re: [2005] User control property to have a drop down list of values
Thanks Warren for the reply but that's not what exactly I'm trying to achieve. Let me try to explain it again.
a.) On a web form I'll place my user control.
b.) User control has a property, TextBoxToFill.
c.) Developer will go into the property and then he should see a list of all the textboxes that are available on the current web form (where the user control has been placed).
What I've tried so far:
In a CustomCompareValidator I've put the attribute
Code:
TypeConverter(GetType(ControlIDConverter))
before a property and that property is able to pick up all the available controls on the form where it has been placed. But when I put the same attribute in this user control it doesn't work. ANy idea why would it be so?