Providing Browse capabilities for a File in property grid

Discussion in 'ASP .Net Building Controls' started by Trevor Andrew, Jul 17, 2003.

  1. Hi There,

    I am developing a custom control which has a property that represents a file
    within the current web application (an XML file as it turns out). I would
    like the property grid builder button to invoke the same sort of editor as
    used by the standard XML web form control properties DocumentSource and
    TransformSource.

    I suspect I have to set the Editor attribute of my control's property to a
    certain value, but I don't know what. Can someone assist?

    Additionally, can someone point me in the direction of documentation from
    which I should have been able to deduce this myself?

    Thanks in Advance,
    Trevor Andrew
     
    Trevor Andrew, Jul 17, 2003
    #1
    1. Advertisements

  2. Hi Trevor,

    DocumentSource uses the XmlUrlEditor and TransformSource uses the
    XslUrlEditor, both types are found in the System.Web.UI.Design namespace.
    You need to use the EditorAttribute metadata attribute to assign an editor
    to your property, ie:
    [C#]
    [Editor(typeof(System.Web.UI.Design.XmlUrlEditor),typeof(System.Drawing.Desi
    gn.UITypeEditor))]
    public String YourProperty

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.
     
    Victor Garcia Aprea [MVP], Jul 17, 2003
    #2
    1. Advertisements

  3. You will need to add a reference to the "System.Design.dll" assembly to your
    project (Solution Explorer->References->Add References). That should do it.

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

     
    Victor Garcia Aprea [MVP], Jul 17, 2003
    #3
  4. You can do some optimizations with C# that you can't do with VB.NET. One of
    the main issues against using VB.NET for control development was a bug in
    the compiler that should be fixed by now (I haven't checked as I don't
    really use vb.net much). If you could make a choice I would suggest using
    C#.

    Regarding obfuscation I really don't see much sense in it at all. I mean, if
    someone wants to decompile your code the obfuscator won't prevent this, it
    will only make his/her job a little bit tedious but not impossible at all.
    So using obfuscation you could avoid newbies eyes to understand the code,
    but anyone with a bit of time would be able to do it. If you *really* want
    to hide some code your best bet may be to implement it in native code and
    call it from your .net code, that will help the hiding a bit, but again, if
    someone takes the decompiling seriously shouldn't have much of a problem
    decompiling it.

    Glad you finally got it working, and thanks for getting back!

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    and not by private mail.

     
    Victor Garcia Aprea [MVP], Jul 18, 2003
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.