web custom control designtime problem

R

rotsj

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.ListItemsCollectionEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(UITypeEditor))]

public List<GroupRights> Rights

{

get

{

return _GroupRights;

}

set

{

_GroupRights = value;

ViewState["Rights"] = Rights;

}

}

}

Thanx in advance,

Rotsj
 
R

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<GroupRights> Rights

{

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 said:
you never read the values back from the viewstate.

-- bruce (sqlwork.com)
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.ListItemsCollectionEditor,System.Design,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(UITypeEditor))]

public List<GroupRights> Rights

{

get

{

return _GroupRights;

}

set

{

_GroupRights = value;

ViewState["Rights"] = Rights;

}

}

}

Thanx in advance,

Rotsj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top