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. Advertising

  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.

    "Trevor Andrew" <> wrote in message
    news:%...
    > 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
    >
    >
     
    Victor Garcia Aprea [MVP], Jul 17, 2003
    #2
    1. Advertising

  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.

    "Trevor Andrew" <> wrote in message
    news:...
    > Hi Victor,
    >
    > Thank you once again ... I will certainly go and take a look at those two
    > books. I should have mentioned that I am building this control on VB.NET,
    > and have translated your answer to the following under VB:
    >
    > Editor(GetType(System.Web.UI.Design.XmlUrlEditor),
    > GetType(System.Drawing.Design.UITypeEditor))
    > And I have an "Imports System.Web.UI" at the top of my VB file, but it

    can't
    > resolve the System.Web.UI.Design.XMLUrlEditor type. I can't find it in the
    > object browser either. There doesn't even appear to be a design namespace
    > under System.Web.UI from where I'm looking. Is this something I can't do
    > with VB.NET or have I got it misconfigured.
    >
    > Once again, your help is much appreciated.
    >
    > Regards,
    >
    > Trevor Andrew
    >
    > "Victor Garcia Aprea [MVP]" <> wrote in message
    > news:...
    >
    > >
    > > >>>>Should I have been able to find that out for myself?

    > > I've answered this question a couple of times; thanks to the great

    > indexing
    > > provided by http://groups.google.com you could have been able to find a
    > > quicker (faster than mine!) answer by searching there.
    > >
    > > >>>>What books documentation do you recommend for gaining
    > > >>>>a deeper understanding of the issues associated with
    > > >>>>web custom control development?

    > > If you're looking into custom control development then there are two

    books
    > > that should read:
    > >
    > > Developing Microsoft ASP.NET Server Controls and Components
    > > by Nikhil Kothari
    > >

    >

    http://www.amazon.com/exec/obidos/ASIN/0735615829/laplatayacom"/104-7550369-4522300
    > >
    > > Professional ASP.NET Server Controls: Building Custom Controls with C#
    > > by Daniel Cazzulino et all
    > >

    >

    http://www.amazon.com/exec/obidos/tg/detail/-/1861005644/laplatayacom/104-7550369-4522300
    > >
    > > I've read the first one and its very recommendable. I've not read the

    > second
    > > one but I've worked as a reviewer for a few of its chapters and they're

    > top
    > > quality. Plus, Daniel Cazzulino really knows his stuff.
    > >
    > > --
    > > 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.
    > >
    > > "Trevor Andrew" <> wrote in message
    > > news:%...
    > > > Hi Victor,
    > > >
    > > > Thank you so much for your very prompt response on this question!
    > > >
    > > > Should I have been able to find that out for myself? What books /
    > > > documentation do you recommend for gaining a deeper understanding of

    the
    > > > issues associated with web custom control development?
    > > >
    > > > Once again, Thank You very much,
    > > > Trevor Andrew
    > > >
    > > > "Victor Garcia Aprea [MVP]" <> wrote in message
    > > > news:...
    > > > > 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.
    > > > >
    > > > > "Trevor Andrew" <> wrote in message
    > > > > news:%...
    > > > > > 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
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    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.

    "Trevor Andrew" <> wrote in message
    news:%...
    > Victor,
    >
    > Your help has been invaluable to me ... I've just gone out and purchased
    > Kothari and Datye book, and at first glance it seems very impressive. Some
    > of the reviews on the other book at Amazon were a little less kind.
    > Unfortunately, purchasing from Amazon isn't a good option for me in
    > Australia because even though the books are cheaper, the freight costs are
    > the killer, and the delays involved are frustrating.
    >
    > One quick question. If I continue down the path I am, and come up with

    what
    > I consider to be a useful ASP.NET custom control, are there any

    significant
    > disadvantages to continuing developing it in VB.NET instead of C#? From my
    > brief reading of the Kothari book's introduction, he suggests that there
    > aren't any significant differences. What's your opinion?
    >
    > And what about issues of code obfuscation? For a commercially released
    > ASP.NET custom control, would you consider obfuscation to be important?
    >
    > I hope I'm not taking too much of your time. Once again, thank you for

    your
    > invaluable help.
    >
    > Regards,
    > Trevor Andrew
    >
    >
    > "Victor Garcia Aprea [MVP]" <> wrote in message
    > news:...
    > > 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.
    > >
    > > "Trevor Andrew" <> wrote in message
    > > news:...
    > > > Hi Victor,
    > > >
    > > > Thank you once again ... I will certainly go and take a look at those

    > two
    > > > books. I should have mentioned that I am building this control on

    > VB.NET,
    > > > and have translated your answer to the following under VB:
    > > >
    > > > Editor(GetType(System.Web.UI.Design.XmlUrlEditor),
    > > > GetType(System.Drawing.Design.UITypeEditor))
    > > > And I have an "Imports System.Web.UI" at the top of my VB file, but it

    > > can't
    > > > resolve the System.Web.UI.Design.XMLUrlEditor type. I can't find it in

    > the
    > > > object browser either. There doesn't even appear to be a design

    > namespace
    > > > under System.Web.UI from where I'm looking. Is this something I can't

    do
    > > > with VB.NET or have I got it misconfigured.
    > > >
    > > > Once again, your help is much appreciated.
    > > >
    > > > Regards,
    > > >
    > > > Trevor Andrew
    > > >
    > > > "Victor Garcia Aprea [MVP]" <> wrote in message
    > > > news:...
    > > >
    > > > >
    > > > > >>>>Should I have been able to find that out for myself?
    > > > > I've answered this question a couple of times; thanks to the great
    > > > indexing
    > > > > provided by http://groups.google.com you could have been able to

    find
    > a
    > > > > quicker (faster than mine!) answer by searching there.
    > > > >
    > > > > >>>>What books documentation do you recommend for gaining
    > > > > >>>>a deeper understanding of the issues associated with
    > > > > >>>>web custom control development?
    > > > > If you're looking into custom control development then there are two

    > > books
    > > > > that should read:
    > > > >
    > > > > Developing Microsoft ASP.NET Server Controls and Components
    > > > > by Nikhil Kothari
    > > > >
    > > >

    > >

    >

    http://www.amazon.com/exec/obidos/ASIN/0735615829/laplatayacom"/104-7550369-4522300
    > > > >
    > > > > Professional ASP.NET Server Controls: Building Custom Controls with

    C#
    > > > > by Daniel Cazzulino et all
    > > > >
    > > >

    > >

    >

    http://www.amazon.com/exec/obidos/tg/detail/-/1861005644/laplatayacom/104-7550369-4522300
    > > > >
    > > > > I've read the first one and its very recommendable. I've not read

    the
    > > > second
    > > > > one but I've worked as a reviewer for a few of its chapters and

    > they're
    > > > top
    > > > > quality. Plus, Daniel Cazzulino really knows his stuff.
    > > > >
    > > > > --
    > > > > 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.
    > > > >
    > > > > "Trevor Andrew" <> wrote in message
    > > > > news:%...
    > > > > > Hi Victor,
    > > > > >
    > > > > > Thank you so much for your very prompt response on this question!
    > > > > >
    > > > > > Should I have been able to find that out for myself? What books /
    > > > > > documentation do you recommend for gaining a deeper understanding

    of
    > > the
    > > > > > issues associated with web custom control development?
    > > > > >
    > > > > > Once again, Thank You very much,
    > > > > > Trevor Andrew
    > > > > >
    > > > > > "Victor Garcia Aprea [MVP]" <> wrote in message
    > > > > > news:...
    > > > > > > 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.
    > > > > > >
    > > > > > > "Trevor Andrew" <> wrote in message
    > > > > > > news:%...
    > > > > > > > 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
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Victor Garcia Aprea [MVP], Jul 18, 2003
    #4
    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. =?Utf-8?B?ZG90bmV0dGVzdGVy?=

    providing search capabilities

    =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Sep 15, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    384
    Bruce Barker
    Sep 15, 2005
  2. Replies:
    2
    Views:
    453
    ashish
    Aug 3, 2006
  3. Adam Sandler
    Replies:
    0
    Views:
    286
    Adam Sandler
    Jan 23, 2007
  4. Rafa³ Ziêba

    Nullable property in property grid

    Rafa³ Ziêba, Jul 3, 2008, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    793
    Rafa³ Ziêba
    Jul 3, 2008
  5. Replies:
    0
    Views:
    244
Loading...

Share This Page