For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > February 2006 > exposing user control to properties explorer









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author exposing user control to properties explorer
stephenpond@gmail.com

2006-02-21, 7:02 pm

I'm currently developing a UserControl in Asp.Net 2 and would like to
expose it's properties to Visual Studio to make reuse of it as simple
as possible. Using attributes I've managed to get properties to
display in the property explorer of Visual Studio, however I'm
struggling when it comes to applying some of the nicer touches - such
as having a URL browser button. I've found tutorials on the web about
how to do this but I don't seem to get the correct functionality out.

I have a code which looks like:

[Browsable(true), Bindable(true), Themeable(false),
Category("Behavior"), Description("Button_PostBackUrl"),
UrlProperty("*.aspx"), DefaultValue(""),
Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(UITypeEditor))]
public virtual string PostBackUrl
{
get
{
string text1 = (string)this.ViewState["PostBackUrl"];
if (text1 != null)
{
return text1;
}
return string.Empty;
}
set
{
this.ViewState["PostBackUrl"] = value;
}
}

When I use this, the property appears in the property browser, however
the url editor button only works if there is some text already entered
into the property's value box. When I enter some text and do finally
bring up the URL editor window, the filter (UrlProperty attribute)
doesn't seem to have any affect as the default filter is *.*.

Any advice on this would be appreciated.

Thanks.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com