Persisting collection

Discussion in 'ASP .Net Web Controls' started by kw, Jul 25, 2004.

  1. kw

    kw Guest

    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, Jul 25, 2004
    #1
    1. Advertising

  2. kw

    Teemu Keiski Guest

    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.aspx?tabindex=1&PostID=225520

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




    "kw" <> wrote in message
    news:%...
    > 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, Jul 26, 2004
    #2
    1. Advertising

  3. kw

    kw Guest

    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" <> wrote in message
    news:...
    > 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.aspx?tabindex=1&PostID=225520
    >
    > --
    > Teemu Keiski
    > MCP, Microsoft MVP (ASP.NET), AspInsiders member
    > ASP.NET Forum Moderator, AspAlliance Columnist
    > http://blogs.aspadvice.com/joteke
    >
    >
    >
    >
    > "kw" <> wrote in message
    > news:%...
    > > 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, Jul 26, 2004
    #3
  4. kw

    Juno Guest

    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" <> дÈëÏûÏ¢ÐÂÎÅ
    :unXz%...
    > 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" <> wrote in message
    > news:...
    > > 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.aspx?tabindex=1&PostID=225520
    > >
    > > --
    > > Teemu Keiski
    > > MCP, Microsoft MVP (ASP.NET), AspInsiders member
    > > ASP.NET Forum Moderator, AspAlliance Columnist
    > > http://blogs.aspadvice.com/joteke
    > >
    > >
    > >
    > >
    > > "kw" <> wrote in message
    > > news:%...
    > > > 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, Jul 28, 2004
    #4
    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. john_teague

    persisting collection in a custom datagrid

    john_teague, Dec 6, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    400
    john_teague
    Dec 6, 2005
  2. john_teague

    persisting collection in a custom datagrid

    john_teague, Dec 6, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    337
    john_teague
    Dec 6, 2005
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    980
    Øyvind Isaksen
    May 18, 2007
  4. Shawn B.

    Persisting Collection in Component

    Shawn B., Oct 4, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    120
    Shawn B.
    Oct 4, 2004
  5. Replies:
    1
    Views:
    292
    Tim Dot NoSpam
    May 19, 2006
Loading...

Share This Page