TypeConverters

Discussion in 'ASP .Net Web Controls' started by MLibby, Sep 30, 2004.

  1. MLibby

    MLibby Guest

    I have web custom control that exposes 3 XML properties ACXMLFile,
    ACXMLString, and ACXMLDocument that I need to convert to one property,
    ACXMLSource. ACXMLFile and ACXMLString are both design time properties while
    ACXMLDocument is only a runtime property. How can I combine these all into
    one property?

    [

    Bindable(true),

    Category("ACXML"),

    DefaultValue(""),

    Description("Path to the XML file containing the content source
    structure."),

    ]

    public virtual string ACXMLFile

    {

    get

    {

    string s = (string)ViewState["ACXMLFile"];

    return ((s == null) ? String.Empty : s);

    }

    set

    {

    ViewState["ACXMLFile"] = value;

    }

    }



    [

    Bindable(true),

    Category("Cache Content ACDefaultUrl"),

    DefaultValue(""),

    Browsable(false),

    Description("XML string containing the content source
    structure."),

    ]

    public virtual string ACXMLString

    {

    get

    {

    string s = (string)ViewState["ACXMLString"];

    return ((s == null) ? String.Empty : s);

    }

    set

    {

    ViewState["ACXMLString"] = value;

    }

    }



    [

    Browsable(false),

    Description("XML document containing the content source
    structure."),

    ]

    public virtual XmlDocument ACXMLDocument

    {

    get

    {

    string s = ACXMLSourceConvert;

    if (s != null)

    {

    XmlDocument xd = new XmlDocument();

    xd.LoadXml(s);

    return xd;

    }

    return (null);

    }

    }

    Mike
    --
    mcp, mcse, mcsd, mcad.net, mcsd.net
     
    MLibby, Sep 30, 2004
    #1
    1. Advertising

  2. Hi Mike,

    Thanks for your posting!

    I think I need more information about your problem. How do you make
    "ACXMLString" and "ACXMLFile" design-time only? Why do you want to "combine
    these 3 properties into one property"?

    I think you may explain your senario more details(such as these properties'
    meaning), then we can find a correct solution for your.

    Thank you for your patience and cooperation. If you have any questions or
    concerns, please feel free to post it in the group. I am standing by to be
    of assistance.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
     
    Jeffrey Tan[MSFT], Oct 1, 2004
    #2
    1. Advertising

  3. MLibby

    MLibby Guest

    Hi Jeffrey,

    I was under the assumption that TypeConverters could be used at runtime.
    I've since found out that TypeConverters can only be used at design time. My
    original thinking was to allow one XML property to service different needs,
    i.e. XMLFileName, XMLDocument, XMLString. I've since learned that this is
    not feasible.

    Please let me know if you've found otherwise,
    MIke
     
    MLibby, Oct 5, 2004
    #3
  4. Hi Mike,

    Thanks very much for your feedback!

    Yes, the most general usage of TypeConverter is to provide a string
    representation for certain property type at design-time IDE Property
    Browser. For more information, please refer to article "Make Your
    Components Really RAD with Visual Studio .NET Property Browser" in MSDN.

    But for your problem, I am not sure what you want to do, since you want to
    combine XMLFileName, XMLDocument and XMLString into one, and they are not
    wanted, why you create them? Also, I think they may be used internally, but
    you do not want them to be used by other control user. For this, I think we
    may specify these 3 properties as private, then use a public property to
    show the essential information to the control user. This is totally based
    on your control logic design.

    Does the private hide 3 properties thought make sense to you? Hope I did
    not misunderstand you.

    Thank you for your patience and cooperation. If you have any questions or
    concerns, please feel free to post it in the group. I am standing by to be
    of assistance.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
     
    Jeffrey Tan[MSFT], Oct 7, 2004
    #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. S.Sigal
    Replies:
    0
    Views:
    1,108
    S.Sigal
    Aug 21, 2004
  2. David Jessee

    Using TypeConverters

    David Jessee, Jul 14, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    115
    Teemu Keiski
    Jul 14, 2003
Loading...

Share This Page