Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Persisting collection

Reply
Thread Tools

Persisting collection

 
 
kw
Guest
Posts: n/a
 
      07-25-2004
The following WebControl contains a collection. On Page PostBack, the
collection is lost. I'm not sure how to persist this. Any ideas?

public class Grid: System.Web.UI.WebControls.WebControl
{
....
public ColumnCollection Columns{get{...}}
....
}
public class ColumnCollection : IDictionary, ICollection, IEnumerable,
ICloneable{...}




 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      07-26-2004
Hi,

you would need to develop a state management mechanism for the collection.
It means implementing viewstate saving, loading and tracking for the
collection (which consists of simlar functionality for collection items)
using IStateManager interface. I've written an example of such at ASp.NET
Forums, if you want to check it out:

http://www.asp.net/Forums/ShowPost.a...&PostID=225520

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke




"kw" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The following WebControl contains a collection. On Page PostBack, the
> collection is lost. I'm not sure how to persist this. Any ideas?
>
> public class Grid: System.Web.UI.WebControls.WebControl
> {
> ...
> public ColumnCollection Columns{get{...}}
> ...
> }
> public class ColumnCollection : IDictionary, ICollection, IEnumerable,
> ICloneable{...}
>
>
>
>



 
Reply With Quote
 
 
 
 
kw
Guest
Posts: n/a
 
      07-26-2004
Thanks, I got it working now, but a new problem came up.

The custom WebControl that creates an array of textboxes (naming them
dynamically), for example:

<INPUT id="c0r0" type="text" runat=server value="Item A" ><INPUT id="c1r0"
type="text" runat=server value="100" ><br>

Now let's say the user changed the value of c1r0 to from '100' to '200' and
clicks an 'Update' button. In the Page_Load postback, none of the controls
are accessible.

How can I access the value of the text input element c1r0?

Or do you think I'm going about this the wrong way?

Thanks!

Dan

"Teemu Keiski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> you would need to develop a state management mechanism for the collection.
> It means implementing viewstate saving, loading and tracking for the
> collection (which consists of simlar functionality for collection items)
> using IStateManager interface. I've written an example of such at ASp.NET
> Forums, if you want to check it out:
>
> http://www.asp.net/Forums/ShowPost.a...&PostID=225520
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
> http://blogs.aspadvice.com/joteke
>
>
>
>
> "kw" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > The following WebControl contains a collection. On Page PostBack, the
> > collection is lost. I'm not sure how to persist this. Any ideas?
> >
> > public class Grid: System.Web.UI.WebControls.WebControl
> > {
> > ...
> > public ColumnCollection Columns{get{...}}
> > ...
> > }
> > public class ColumnCollection : IDictionary, ICollection, IEnumerable,
> > ICloneable{...}
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Juno
Guest
Posts: n/a
 
      07-27-2004
Hi,

try this: youcontrol.controls(0). It returns the first control in your
coustom webcontrol.Then you can convert it to textbox web control.



--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET


"kw" <(E-Mail Removed)> 写入消息新闻
:unXz%(E-Mail Removed)...
> Thanks, I got it working now, but a new problem came up.
>
> The custom WebControl that creates an array of textboxes (naming them
> dynamically), for example:
>
> <INPUT id="c0r0" type="text" runat=server value="Item A" ><INPUT id="c1r0"
> type="text" runat=server value="100" ><br>
>
> Now let's say the user changed the value of c1r0 to from '100' to '200'

and
> clicks an 'Update' button. In the Page_Load postback, none of the

controls
> are accessible.
>
> How can I access the value of the text input element c1r0?
>
> Or do you think I'm going about this the wrong way?
>
> Thanks!
>
> Dan
>
> "Teemu Keiski" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > you would need to develop a state management mechanism for the

collection.
> > It means implementing viewstate saving, loading and tracking for the
> > collection (which consists of simlar functionality for collection items)
> > using IStateManager interface. I've written an example of such at

ASp.NET
> > Forums, if you want to check it out:
> >
> > http://www.asp.net/Forums/ShowPost.a...&PostID=225520
> >
> > --
> > Teemu Keiski
> > MCP, Microsoft MVP (ASP.NET), AspInsiders member
> > ASP.NET Forum Moderator, AspAlliance Columnist
> > http://blogs.aspadvice.com/joteke
> >
> >
> >
> >
> > "kw" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > The following WebControl contains a collection. On Page PostBack, the


> > > collection is lost. I'm not sure how to persist this. Any ideas?
> > >
> > > public class Grid: System.Web.UI.WebControls.WebControl
> > > {
> > > ...
> > > public ColumnCollection Columns{get{...}}
> > > ...
> > > }
> > > public class ColumnCollection : IDictionary, ICollection, IEnumerable,
> > > ICloneable{...}
> > >
> > >
> > >
> > >

> >
> >

>
>




 
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
Collection problems (create Collection object, add data to collection, bind collection to datagrid) 貀vind Isaksen ASP .Net 1 05-18-2007 09:24 AM
Persisting collection data of a webcontrol when leaving the collection editor in VS2005 mehdi.mousavi@gmail.com ASP .Net Building Controls 1 05-19-2006 03:49 PM
persisting collection in a custom datagrid john_teague ASP .Net 0 12-06-2005 11:26 PM
persisting collection in a custom datagrid john_teague ASP .Net 0 12-06-2005 11:04 PM
Persisting Collection in Component Shawn B. ASP .Net Building Controls 0 10-04-2004 09:33 PM



Advertisments