|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
a dropdown list in the "Properties" windowI have developed a custom webcontrol, that can be used in a webform. The custom control inherits from TextBox webcontrol. I need to have a public property in this custom control that will show as a dropdown list in the "Properties" window of Visual Studio IDE. The options for selection in this dropdown would be the variables/objects declared in the webform, that is, the parent container of the custom control. My problem: I don't know how to do this. Is there any hint, advice, sample, start point to give me? TIA, Leonardo Hi,
simple way is to create a enum (enumeration) which represents these values and have that as type of the property. It would get a selection list in Property Browser automatically. However, as you say that options consist of other objects on the form, then it already requires a custom type converter and you'd apply this to be the type converter for the property in question. Implementing a Type Converter http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconimplementingtypeconverter.asp I could implement sucessfully a TypeConverter. If I have an ArrayList
of strings, it shows up as a dropdownlist in Visual Studio IDE. But I don't know how to pass to the type converter class a list of declared objects in the form that the control is placed. Any idea? TIA, Leonardo Not exactly :-) , I'm just having vacation so responding can be slow
sometimes. :-) Here's one example how those controls are got within a TypeConverter http://weblogs.asp.net/asmith/archive/2003/09/04/26360.aspx
Please Help: ListBox.SelectedItem returns null
Can aspnet simulate windows pane separator? Error: Multiple controls with the same ID ListItem individual Color Web User Controls: Exposing Items property of contained controls Load User Control from different directory Collection with the correct object type on the Collection dialog DropDownList <optgroup> Dropdownlist headings Setting control value in Javascript |
|||||||||||||||||||||||