VS Designer: 'X' could not be set on property 'Y'
1 min read
1 min read
public List<SomeControl> SomeControls
{
get
{
...
}
set
{
...
}
}
<mySrvCtrls:MyServerControl id="mySrvControl1" runat="server" ...>
<mySrvCtrls:SomeControl id="...1" runat="server" ... >
<mySrvCtrls:SomeControl id="...2" runat="server" ... >
<mySrvCtrls:SomeControl id="...3" runat="server" ... >
</mySrvCtrls>
'SomeControl' could not be set on property 'SomeControls'Apparently the problem is that collections of controls such as my "SomeControls" (dummy) property here, have to be specified as readonly, meaning to change them to something like
public List<SomeControl> SomeControls
{
get
{
...
}
}
public List<SomeControl> SomeControls
{
get
{
if(_SomeControls == null)
_SomeControls = new List<SomeControl>();
return _SomeControls;
}
}