Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Persisting collection (http://www.velocityreviews.com/forums/t773884-persisting-collection.html)

kw 07-25-2004 06:20 PM

Persisting collection
 
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{...}





Teemu Keiski 07-26-2004 03:53 PM

Re: Persisting collection
 
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" <elitecommerceserver@hotmail.com> wrote in message
news:%23tqgUQncEHA.1764@TK2MSFTNGP10.phx.gbl...
> 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{...}
>
>
>
>




kw 07-26-2004 04:59 PM

Re: Persisting collection
 
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" <joteke@aspalliance.com> wrote in message
news:eewzqiycEHA.1888@TK2MSFTNGP12.phx.gbl...
> 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" <elitecommerceserver@hotmail.com> wrote in message
> news:%23tqgUQncEHA.1764@TK2MSFTNGP10.phx.gbl...
> > 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{...}
> >
> >
> >
> >

>
>




Juno 07-27-2004 11:57 PM

Re: Persisting collection
 
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" <elitecommerceserver@hotmail.com> 写入消息新闻
:unXz%23HzcEHA.2140@TK2MSFTNGP09.phx.gbl...
> 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" <joteke@aspalliance.com> wrote in message
> news:eewzqiycEHA.1888@TK2MSFTNGP12.phx.gbl...
> > 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" <elitecommerceserver@hotmail.com> wrote in message
> > news:%23tqgUQncEHA.1764@TK2MSFTNGP10.phx.gbl...
> > > 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{...}
> > >
> > >
> > >
> > >

> >
> >

>
>






All times are GMT. The time now is 11:00 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.