Saturday, March 24, 2012

web custom control designtime problem

Hello,

I would like to make my own dropdownlist and add a collection as a generic
List.
When I enter items @dotnet.itags.org. designtime, @dotnet.itags.org. runtime they are gone.

Can anyone tell me please what the problem is?

This is my code:

[ToolboxBitmap(typeof(DropDownList))]

[ToolboxData("<{0}:MaxDropDownList runat=server></{0}:MaxDropDownList>")]

public class MaxDropDownList : System.Web.UI.WebControls.DropDownList,
IMaxControl

{

private List<GroupRights_GroupRights = new List<GroupRights>();

[Category("Rights")]

[Editor("System.Web.UI.Design.WebControls.ListItemsCollecti onEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(UITypeEditor))]

public List<GroupRightsRights

{

get

{

return _GroupRights;

}

set

{

_GroupRights = value;

ViewState["Rights"] = Rights;

}

}

}

Thanx in advance,

Rotsjyou never read the values back from the viewstate.

-- bruce (sqlwork.com)

rotsj wrote:

Quote:

Originally Posted by

Hello,
>
I would like to make my own dropdownlist and add a collection as a generic
List.
When I enter items @. designtime, @. runtime they are gone.
>
Can anyone tell me please what the problem is?
>
This is my code:
>
[ToolboxBitmap(typeof(DropDownList))]
>
[ToolboxData("<{0}:MaxDropDownList runat=server></{0}:MaxDropDownList>")]
>
public class MaxDropDownList : System.Web.UI.WebControls.DropDownList,
IMaxControl
>
{
>
private List<GroupRights_GroupRights = new List<GroupRights>();
>
[Category("Rights")]
>
[Editor("System.Web.UI.Design.WebControls.ListItemsCollecti onEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(UITypeEditor))]
>
public List<GroupRightsRights
>
{
>
get
>
{
>
return _GroupRights;
>
}
>
set
>
{
>
_GroupRights = value;
>
ViewState["Rights"] = Rights;
>
}
>
}
>
}
>
Thanx in advance,
>
Rotsj
>
>


thank you for your reply.

when I change the "rights" property like below it still doesn't work:
(In the Get method i first read the viewstate)

public List<GroupRightsRights

{

get

{

_GroupRights = (List<GroupRights>)ViewState["Rights"];

return _GroupRights;

}

set

{

_GroupRights = value;

ViewState["Rights"] = Rights;

}

}

The control does not remember anything. Even in designtime it will not
remember his items.

Thanx in advance,
Rotsj

"bruce barker" <nospam@.nospam.comschreef in bericht
news:O2$IhfPNHHA.5104@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

you never read the values back from the viewstate.
>
-- bruce (sqlwork.com)
>
rotsj wrote:

Quote:

Originally Posted by

>Hello,
>>
>I would like to make my own dropdownlist and add a collection as a
>generic List.
>When I enter items @. designtime, @. runtime they are gone.
>>
>Can anyone tell me please what the problem is?
>>
>This is my code:
>>
>[ToolboxBitmap(typeof(DropDownList))]
>>
>[ToolboxData("<{0}:MaxDropDownList runat=server></{0}:MaxDropDownList>")]
>>
>public class MaxDropDownList : System.Web.UI.WebControls.DropDownList,
>IMaxControl
>>
>{
>>
>private List<GroupRights_GroupRights = new List<GroupRights>();
>>
>[Category("Rights")]
>>
>[Editor("System.Web.UI.Design.WebControls.ListItemsCollecti onEditor,System.Design,
>Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
>typeof(UITypeEditor))]
>>
>public List<GroupRightsRights
>>
>{
>>
>get
>>
>{
>>
>return _GroupRights;
>>
>}
>>
>set
>>
>{
>>
>_GroupRights = value;
>>
>ViewState["Rights"] = Rights;
>>
>}
>>
>}
>>
>}
>>
>Thanx in advance,
>>
>Rotsj
>>

0 comments:

Post a Comment