Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Paul Endersby #1
Collection Persistence
All,
I'm sorry for asking this cause I know it has been asked a thousand times
before, but I don't seem to be able to find a complete solution that works.
I have a custom collection implemented as follows:
public class PropertyInfo
{
private string _Property = "";
private string _BusinessObject = null;
public PropertyInfo(){}
public string Property
{
get{return _Property;}
set{_Property = value;}
}
public string BusinessObject
{
get{return _BusinessObject;}
set{_BusinessObject = value;}
}
}
public class fdsPropertyCollection: System.Collections.CollectionBase
{
public PropertyInfo this[int index]
{
get {return List[index] as PropertyInfo;}
set {List[index] = value;}
}
public int Add(PropertyInfo item)
{
return List.Add(item);
}
}
Then, in my component I have a public property declared as:
protected fdsPropertyCollection _Properties = new fdsPropertyCollection();
public fdsPropertyCollection Properties
{
get{return _Properties;}
}
I can use my component and add new items to the collection fine no problems
there. My problem comes when I look at the HTML generated for my property it
has written:
Properties="(Collection)" Properties-Count="2"
This is clearly not what I want to happen, but I have no idea what I am
supposed to do. I've tried adding type converters to the PropertyInfo class,
I've tried adding an CollectionEditor class to the Custom collection. I've
had varying combinations of the ParseChildren and PersistChildren attributes
in my component and I've tried adding the PersistenceMode attribute to the
components property. All have which have resulted in varying flavours of
failure!
My code almost exactly represents the code in the article:
[url]http://www.codeproject.com/cs/miscctrl/extendedlistviews.asp?df=100&forumid=13645&fr=51[/url]
This however hasn't helped me :*-(
Please help, I'm pulling my hair out on what should be a really simple task.
Regards,
Paul.
Paul Endersby Guest
-
Persisting collection data of a webcontrol when leaving the collection editor in VS2005
Hi folks, I'm developing a WebControl, that has got a property that's supposed to return a collection of data. Whenever I try to populate the... -
Adding to collection from controlDesigner only produces end tag for the collection.
I have a customDesigner that adds to a collection in my control. For some reason on the closing tag is added to the HTML view. My control is... -
How to bing a collection with sub-collection to grid
I have a collection of objects (say Customers for example). Each Customer Object has a collection of orders. When I bind such complex type to... -
Persistence
Hi, I have a datagrid with a checkbox column. The datagrid is using paging and sorting. When I click on a checkbox then go to page 2 (or any... -
help for properties persistence
Hi. I'm developing a WebControl that uses the following custom attributes: I'm using ParseChildren(false), because i've got two collection... -
Paul Endersby #2
Re: Collection Persistence
Any one any idea why this is soooooooo hard? All I want is a collection with
two strings in it that's editable and persists at design time.
"Paul Endersby" <p.endersby@removespamfdsltd.co.uk> wrote in message
news:3f6060ca$0$33800$65c69314@mercury.nildram.net ...works.> All,
>
> I'm sorry for asking this cause I know it has been asked a thousand times
> before, but I don't seem to be able to find a complete solution thatproblems>
> I have a custom collection implemented as follows:
>
> public class PropertyInfo
> {
> private string _Property = "";
> private string _BusinessObject = null;
>
> public PropertyInfo(){}
>
> public string Property
> {
> get{return _Property;}
> set{_Property = value;}
> }
> public string BusinessObject
> {
> get{return _BusinessObject;}
> set{_BusinessObject = value;}
> }
> }
>
> public class fdsPropertyCollection: System.Collections.CollectionBase
> {
> public PropertyInfo this[int index]
> {
> get {return List[index] as PropertyInfo;}
> set {List[index] = value;}
> }
> public int Add(PropertyInfo item)
> {
> return List.Add(item);
> }
> }
>
> Then, in my component I have a public property declared as:
>
> protected fdsPropertyCollection _Properties = new fdsPropertyCollection();
> public fdsPropertyCollection Properties
> {
> get{return _Properties;}
> }
>
> I can use my component and add new items to the collection fine noit> there. My problem comes when I look at the HTML generated for my propertyclass,> has written:
>
> Properties="(Collection)" Properties-Count="2"
>
> This is clearly not what I want to happen, but I have no idea what I am
> supposed to do. I've tried adding type converters to the PropertyInfoattributes> I've tried adding an CollectionEditor class to the Custom collection. I've
> had varying combinations of the ParseChildren and PersistChildren[url]http://www.codeproject.com/cs/miscctrl/extendedlistviews.asp?df=100&forumid=13645&fr=51[/url]> in my component and I've tried adding the PersistenceMode attribute to the
> components property. All have which have resulted in varying flavours of
> failure!
>
> My code almost exactly represents the code in the article:
>
>task.>
> This however hasn't helped me :*-(
>
> Please help, I'm pulling my hair out on what should be a really simple>
> Regards,
>
> Paul.
>
>
Paul Endersby Guest



Reply With Quote

