ASP.NET 1.1As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I'm coding a control, and I was curious if anybody knew how I could make a property show a browse button, so I can browse in the current project and select a URL, similar to the errorPage property for a web form.
Any ideas, or anybody know where I should start researching?
Are you building a Custom / Server control? If so, you can use the EditorAttribute on your property. If you look in the System.Web.UI.Design namespace, you'll see various editors like the ImageUrlEditor (to browse for an image) and the UrlEditor. The following code shows a C# declaration for an ImageURL property:
Code:
[
Category("Appearance"),
Description("The relative path to an image file within the virtual directory to use for the bars."),
EditorAttribute(typeof(System.Web.UI.Design.ImageUrlEditor), typeof(System.Drawing.Design.UITypeEditor))
]
public string BarImage
// Rest of property here
When you compile this code, the Property Grid will display a button with ellipses. Once you click it, you'll get a dialog that allows you to select an image. The same applies to the UrlEditor.
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Yes, I am developing a custom control. I'll look into that, Thanks for the help. Is there a resource on the web or in the MSDN that has all of the editor types?
I don't know of a definite list with all classes that derive from UITypeEditor, but it's quite possible such an overview exists somewhere.
I have spent some time developing design-time support for custom controls, and I found it very hard to find useful information. However, once you know the terms you need to search for (UITypeEditor, TypeConverter, EditorAttribute, ControlDesigner etc etc) it becomes easier to find snippets of code that are useful.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.