web custom control designtime problem

Discussion in 'ASP .Net' started by rotsj, Jan 10, 2007.

  1. rotsj

    rotsj Guest

    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
     
    rotsj, Jan 10, 2007
    #1
    1. Advertising

  2. rotsj

    bruce barker Guest

    you never read the values back from the viewstate.

    -- bruce (sqlwork.com)

    rotsj wrote:
    > 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
    >
    >
     
    bruce barker, Jan 10, 2007
    #2
    1. Advertising

  3. rotsj

    rotsj Guest

    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" <> schreef in bericht
    news:O2$...
    > you never read the values back from the viewstate.
    >
    > -- bruce (sqlwork.com)
    >
    > rotsj wrote:
    >> 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
    >>
     
    rotsj, Jan 11, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chip
    Replies:
    1
    Views:
    391
  2. Mike

    Refreash DesignTime control.

    Mike, Jan 11, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    422
  3. Alessandro Zifiglio

    Deleting controls at designtime in web Custom templated control

    Alessandro Zifiglio, Dec 13, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    151
    Alessandro Zifiglio
    Dec 13, 2003
  4. Chuck P

    composite control embedded resource at designtime

    Chuck P, Sep 24, 2007, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    893
    Walter Wang [MSFT]
    Sep 25, 2007
  5. Mike

    Refreash DesignTime control.

    Mike, Jan 11, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    139
Loading...

Share This Page