Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > web custom control designtime problem

Reply
Thread Tools

web custom control designtime problem

 
 
rotsj
Guest
Posts: n/a
 
      01-10-2007
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.ListItems CollectionEditor,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


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      01-10-2007
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.ListItems CollectionEditor,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
>
>

 
Reply With Quote
 
 
 
 
rotsj
Guest
Posts: n/a
 
      01-11-2007
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" <(E-Mail Removed)> schreef in bericht
news:O2$(E-Mail Removed)...
> 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.ListItems CollectionEditor,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
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
composite control embedded resource at designtime Chuck P ASP .Net Building Controls 1 09-25-2007 04:29 AM
Refreash DesignTime control. Mike ASP .Net Web Controls 2 01-11-2006 07:24 PM
Refreash DesignTime control. Mike ASP .Net 0 01-11-2006 03:06 PM
Deleting controls at designtime in web Custom templated control Alessandro Zifiglio ASP .Net Building Controls 0 12-13-2003 02:09 PM
ControlDesigner not invoked on custom control when control is rendered within another custom control Matt Sokol ASP .Net Building Controls 2 08-07-2003 07:13 AM



Advertisments