TypeConverter for a StringCollection or a Generics list
- From: Imar Spaanjaars <ImarSpaanjaars@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 Apr 2008 00:20:00 -0700
Hello everyone,
I am trying to write a TypeConverter for a property of type StringCollection
or List<string> that I want to persist as a comma separated value in my own
server control. E.g. in markup I want to be able to use this:
<isp:SomeControl Value="1,2,3" runat="server" ID=MyControl" />
While in code, I want to be able to use something like:
MyControl.Value.Add(1);
Can anyone point me in the right direction on how to do this? I looked at
the StringArrayConverter in the WebControls namespace which seems close to
what I want to accomplish but I couldn't make it work.
I tried different flavors of code involving ITypeDescriptorContext, various
CanConvert* methods etc but none seem to work so far. I either get no
results, or I get run-time errors.
In case anyone wants to give this a try, here's the code for the actual
control with the StringCollection property and the converter:
(Converter)
http://imar.spaanjaars.com/Downloads/Other/ServerControls/StringCollectionTypeConverter.txt
(Control)
http://imar.spaanjaars.com/Downloads/Other/ServerControls/ModuleSettings.txt
Any help would be greatly appreciated. I posted this question a few months
ago as well, but never got a response. Hopefully, things will be different
this time. If you need more information, please let me know
Warm regards,
Imar
http://imar.spaanjaars.com/
.
- Prev by Date: Details Window (Popup)
- Next by Date: PerformanceCounterCategory.Create() takes 3 minutes to add a new category!! How come? What can cause this?
- Previous by thread: Details Window (Popup)
- Next by thread: PerformanceCounterCategory.Create() takes 3 minutes to add a new category!! How come? What can cause this?
- Index(es):
Relevant Pages
|