Creating Server Controls

J

Jonathan Wood

Okay, I'm stuck.

I have a stack of ASP.NET books, the Internet, and a bunch of time I've
spent. I've tried dozens of code samples, all of which either didn't have
any effect or wouldn't compile. Can someone please let me know the secret
cantation.

I'm creating a server control and I want to improve the editor
functionality. For example, if I have a URL property, I'd like to use the
same editor that is used to edit URLs in the standard server controls (the
ones that come with VS). Surely, there must be some straight forward syntax
for this, and perhaps a site that lists valid values!

I've tried searching for Designers, Editors, and tried adding attributes
such as [Editor(...)], [EditorAttribute(...)], [UrlProperty] and absolutely
nothing will come even close to working for me.

I would just like to know how to have the property editor to use the same
code used by Visual Studio for the standard server controls.

Can anyone help?

Thanks.

Jonathan
 
P

Patrice

Hello,

You could use a tool such as Reflector to see what are the attributes. For
example, for Image.ImageUrl it shows :

[DefaultValue(""), Editor("System.Web.UI.Design.ImageUrlEditor,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)), UrlProperty,
WebSysDescription("Image_ImageUrl"), Bindable(true),
WebCategory("Appearance")]

This tool is available from :
http://www.red-gate.com/products/reflector/

Also :
http://referencesource.microsoft.com/
should allow to download the source code to see how it's done.

Both should allow to see if you are missing some attribute or if some value
is not properly defined...
 
J

Jonathan Wood

Thanks, I actually did just that since my original post.

The problem I'm having with this is all the version, culture, and public key
token information included. I've seen examples that don't use that and it
suggests to me that it would make my code incompatible with any other
version of .NET.

I guess I need a good server control development book; however, I should
probably wait for one to come out for VS2010.

Jonathan

Patrice said:
Hello,

You could use a tool such as Reflector to see what are the attributes. For
example, for Image.ImageUrl it shows :

[DefaultValue(""), Editor("System.Web.UI.Design.ImageUrlEditor,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)), UrlProperty,
WebSysDescription("Image_ImageUrl"), Bindable(true),
WebCategory("Appearance")]

This tool is available from :
http://www.red-gate.com/products/reflector/

Also :
http://referencesource.microsoft.com/
should allow to download the source code to see how it's done.

Both should allow to see if you are missing some attribute or if some
value is not properly defined...

--
Patrice

Jonathan Wood said:
Okay, I'm stuck.

I have a stack of ASP.NET books, the Internet, and a bunch of time I've
spent. I've tried dozens of code samples, all of which either didn't have
any effect or wouldn't compile. Can someone please let me know the secret
cantation.

I'm creating a server control and I want to improve the editor
functionality. For example, if I have a URL property, I'd like to use the
same editor that is used to edit URLs in the standard server controls
(the ones that come with VS). Surely, there must be some straight forward
syntax for this, and perhaps a site that lists valid values!

I've tried searching for Designers, Editors, and tried adding attributes
such as [Editor(...)], [EditorAttribute(...)], [UrlProperty] and
absolutely nothing will come even close to working for me.

I would just like to know how to have the property editor to use the same
code used by Visual Studio for the standard server controls.

Can anyone help?

Thanks.

Jonathan
 
J

Jonathan Wood

Thanks. But, in contrast, I find the documentation largely unusable and
general avoid MSDN pages when searching on the Web.

My biggest complaint is that sifting through page after page is required
when one paragraph and a code sample would've been a dozen times more clear.
Fortunately, those paragraphs and code samples are usually available.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top