Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Server Control Property Editor

Status
Not open for further replies.

onedizzydevil

Programmer
Mar 24, 2001
103
US
Hi Folks!

Need some help.

Building a Customer WEB Server Control using VB.NET and I am trying to set the Editor Attribute to the following property:

Code:
<Bindable(True), Category(&quot;Appearance&quot;), DefaultValue(&quot;&quot;), Editor(CType(System.Web.UI.Design.ImageUrlEditor, System.Drawing.Design.UITypeEditor))> _
Property [BackButtonImage]() As String
   Get
      Return _BackButtonImage
   End Get

   Set(ByVal Value As String)
      _BackButtonImage = Value
   End Set
End Property

The above code is suppose to work by adding
Code:
Imports System.ComponentModel
. But it is not working. I have searched the InterNut for several hours but all the examples/documention keep pointing me back to this. However the error I keep getting is &quot;Design is not a member of UI&quot; I have ran out of ideas. This is what I get from the Object Browser

Public Class ImageUrlEditor
Inherits System.Web.UI.Design.UrlEditor
Member of System.Web.UI.Design


Wayne Sellars

&quot;Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0.&quot;
 
Wayne --

Your post is a bit beyond me -- but I must say I really enjoyed the exercise of learning more about these Web Server Controls. It doesn't take long to appreciate how valuable it can be to alter run time parameters --

I will enjoy following this one to a solution, I would like to test this for the experience.

I'm sure you must have tried this, and its a &quot;shot in the dark&quot; - but at least a shot --

Instead of:

...
Editor(CType(System.Web.UI.Design.ImageUrlEditor, System.Drawing.Design.UITypeEditor))> _
...

Does it make sense to change to (derived from an example):

...
Editor(GetType(ImageUrlEditor), GetType(UITTypeEditor))>_
...

Just from an example I ran into...

Also, and this may not be related at all, in all the examples I reviewed there seem to be a name associated with the Property statement, e.g., Property Overrides, etc...

 
Okay, little update. Evidently I just needed a little sleep, and a good thing I just needed a little considing I went to bed and 12 and got up at 4 to start researching this again.

The solutions to the problem above is as follows:

1. Despite what the book says you need to add a reference to your project:
Code:
System.Design

2. You have to add
Code:
IMPORTS System.Web.UI.Design
in order get access to the editors (there is whole list of them)

3. Despite what the book says the proper syntax for the Editor attribute is

VB.NET Syntax

Code:
Editor(GetType(ImageUrlEditor), GetType( System.Drawing.Design.UITypeEditor))


The for the entire property, as a reference, looks like this:
Code:
Dim _BackButtonImage As String

<Bindable(True), Editor(GetType(ImageUrlEditor), GetType(System.Drawing.Design.UITypeEditor)), Category(&quot;Appearance&quot;), DefaultValue(&quot;&quot;), Description(&quot;Text for the Back button ButtonType is Link or Form.&quot;)> _
Property [BackButtonImage]() As String
    Get
       Return _BackButtonImage
    End Get
    Set(ByVal Value As String)
       _BackButtonImage = Value
    End Set
End Property



Wayne Sellars

&quot;Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0.&quot;
 
Wayne --

I thought about reference too, System.Design... and so see that was part of the problem. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top