Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   TypeConverters (http://www.velocityreviews.com/forums/t774381-typeconverters.html)

MLibby 09-30-2004 06:15 PM

TypeConverters
 
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

Jeffrey Tan[MSFT] 10-01-2004 07:45 AM

RE: TypeConverters
 
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.


MLibby 10-05-2004 02:05 PM

RE: TypeConverters
 
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


Jeffrey Tan[MSFT] 10-07-2004 03:35 AM

RE: TypeConverters
 
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.



All times are GMT. The time now is 01:06 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.