How do I use the URL picker?

Discussion in 'ASP .Net Building Controls' started by Guest, Feb 6, 2006.

  1. Guest

    Guest Guest

    I'm creating a custom web control and a few of the properties should be
    image URLs. How do you get the system to present the URL picker as an
    option when the user is setting the control's properties? (Like the
    standard controls do for image URLs...) Thanks.

    Jerry
     
    Guest, Feb 6, 2006
    #1
    1. Advertising

  2. Hi Jerry,

    Welcome to the ASPNET newsgroup.

    As for how to let our custom webcontrol's string property use the "URL
    picker" at design-time(in VS.NET ide), based on my research, we can use the
    "EditorAttribute" to apply some certain control editor to our custom
    control's string property. There exists some buildin control property
    editors in .net framework class library, for example:

    UrlEditor, ImageUrlEditor....

    Here is simple test control which configure its "Text" propety to use the
    "ImageUrlEditor" at design-time in VS.NET ide:

    =====================================
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:TestControl runat=server></{0}:TestControl>")]
    public class TestControl : WebControl
    {
    [Bindable(true)]
    [Category("Appearance")]
    [DefaultValue("")]
    [Localizable(true)]
    [ Editor("System.Web.UI.Design.ImageUrlEditor, System.Design,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
    typeof(UITypeEditor))]
    public string Text
    {
    get
    {
    String s = (String)ViewState["Text"];
    return ((s == null) ? String.Empty : s);
    }

    set
    {
    ViewState["Text"] = value;
    }
    }
    ==================================

    Hope this helps.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Feb 7, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman

    Date Time Picker

    Charles A. Lackman, Nov 24, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,093
  2. Jon paugh
    Replies:
    1
    Views:
    953
  3. URL Picker in VS 2005 Property Window

    , Oct 25, 2006, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    116
  4. Just D.
    Replies:
    0
    Views:
    556
    Just D.
    Aug 11, 2004
  5. JStemerdink

    URL picker in webcontrol

    JStemerdink, Sep 16, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    163
    JStemerdink
    Sep 16, 2003
Loading...

Share This Page