C
Class
Hi all,
I'm building a custom control. I would like that on the control you can set
some 'rights'
For that I have an enum:
public enum GroupRights
{
Group0 = 0,
Group1 = 1,
Group2 = 2,
Group3 = 3,
Group4 = 4,
Group5 = 5,
}
In design time I want to set these right (can be multiple rights at the same
time)
So I put them in a generic list:
[Category("Rights")]
[DefaultValue("")]
[Localizable(true)]
[Bindable(true)]
public List<GroupRights> ControlRights
{
get
{
List<GroupRights> temp = (List<GroupRights>)ViewState["ControlRights"];
return ((object)temp == null) ? new List<GroupRights>() : temp;
}
set
{
ViewState["ControlRights"] = value;
}}
In desgin time I get the controls window with the GrouRights enum to choose
from.
But when I add one right in the collection window I get the message:
Cannot create an object of type
'System.Collections.Generic.List`1[[GroupRights, MaxControls,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' from its string
representation '(Collection)' for the 'ControlRights' property.
Also the property can not be read out during runtime.
What am I doing wrong or forgetting?
tia,
Class
I'm building a custom control. I would like that on the control you can set
some 'rights'
For that I have an enum:
public enum GroupRights
{
Group0 = 0,
Group1 = 1,
Group2 = 2,
Group3 = 3,
Group4 = 4,
Group5 = 5,
}
In design time I want to set these right (can be multiple rights at the same
time)
So I put them in a generic list:
[Category("Rights")]
[DefaultValue("")]
[Localizable(true)]
[Bindable(true)]
public List<GroupRights> ControlRights
{
get
{
List<GroupRights> temp = (List<GroupRights>)ViewState["ControlRights"];
return ((object)temp == null) ? new List<GroupRights>() : temp;
}
set
{
ViewState["ControlRights"] = value;
}}
In desgin time I get the controls window with the GrouRights enum to choose
from.
But when I add one right in the collection window I get the message:
Cannot create an object of type
'System.Collections.Generic.List`1[[GroupRights, MaxControls,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' from its string
representation '(Collection)' for the 'ControlRights' property.
Also the property can not be read out during runtime.
What am I doing wrong or forgetting?
tia,
Class