dynamic web user control and viewstate

Discussion in 'ASP .Net Web Controls' started by Andy Fish, Sep 22, 2004.

  1. Andy Fish

    Andy Fish Guest

    Hi,

    I am trying to get to grips with dynamic controls and viewstate, but my
    situaition is more complicated as I am actually using a web user control. I
    thought if I can explain what I'm trying to achieve maybe someone can point
    out the best way to approach it.

    On the window is a list of items displayed through a repeater. The user can
    click to edit a single item. this generates a postback which causes an edit
    panel to be displayed in the middle of the list. The edit panel is a web
    user control created with LoadControl() and it has text boxes and other
    server controls on it, so it needs to (a) respond to postback events and (b)
    have viewstate.

    Two ideas I have had but not tried are (1) have a single control statically
    placed on the page but somehow move it to the right place in PreRender; or
    (2) declare an instance of the control in the <ItemTemplate> so there is one
    for every item, but make them all invisible apart from the one the user is
    actually editing. Is either of these workable/advisable or is there a better
    solution?

    TIA for any suggestions

    Andy
    Andy Fish, Sep 22, 2004
    #1
    1. Advertising

  2. Well it's a better way to use dynamic creation. Eather with LoadControl or
    new class instance creation...

    --
    RobertK
    { Clever? No just smart. }

    "Andy Fish" <> wrote in message
    news:ubuv#...
    > Hi,
    >
    > I am trying to get to grips with dynamic controls and viewstate, but my
    > situaition is more complicated as I am actually using a web user control.

    I
    > thought if I can explain what I'm trying to achieve maybe someone can

    point
    > out the best way to approach it.
    >
    > On the window is a list of items displayed through a repeater. The user

    can
    > click to edit a single item. this generates a postback which causes an

    edit
    > panel to be displayed in the middle of the list. The edit panel is a web
    > user control created with LoadControl() and it has text boxes and other
    > server controls on it, so it needs to (a) respond to postback events and

    (b)
    > have viewstate.
    >
    > Two ideas I have had but not tried are (1) have a single control

    statically
    > placed on the page but somehow move it to the right place in PreRender; or
    > (2) declare an instance of the control in the <ItemTemplate> so there is

    one
    > for every item, but make them all invisible apart from the one the user is
    > actually editing. Is either of these workable/advisable or is there a

    better
    > solution?
    >
    > TIA for any suggestions
    >
    > Andy
    >
    >
    >
    Robert Koritnik, Sep 23, 2004
    #2
    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. ABC
    Replies:
    1
    Views:
    2,634
    Larry
    Oct 4, 2005
  2. ABC
    Replies:
    0
    Views:
    477
  3. =?Utf-8?B?UHJvZGlwIEsgU2FoYQ==?=

    Dynamic Loading of User Control with ViewState Preserved (Live Dem

    =?Utf-8?B?UHJvZGlwIEsgU2FoYQ==?=, Oct 28, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    5,682
    =?Utf-8?B?UHJvZGlwIEsgU2FoYQ==?=
    Oct 28, 2005
  4. ABC
    Replies:
    0
    Views:
    196
  5. Prodip K Saha
    Replies:
    0
    Views:
    122
    Prodip K Saha
    Oct 28, 2005
Loading...

Share This Page