How to maintain the viewstate in server control?

Discussion in 'ASP .Net Web Controls' started by J Gopinath, Jun 2, 2004.

  1. J Gopinath

    J Gopinath Guest

    Hi,
    I am creating server control. Which is having one datagrid and three
    buttons.
    Data Grid is playing all the records of particular table.
    And the other four buttons are 'Add, Edit, Delete'.
    When I click the 'Add' button, the new screen will be displayed.
    In server control page, I'm using EnsureChildControls() method.
    The method will check, whether childControlsCreated or not. If it is not
    created and it will
    call the CreateChildControls() method automatically (Basic for creating
    server control).

    Now the controls are created and I am clicking the 'add' button. Again it
    calls the 'EnsureChildControls()' method.
    And it automatically calls the CreateChildControls() method. So whenever I
    post a request to server,
    the server control rebuild and placed in the page. I don't want to rebuild
    the server controls for every post back.
    I want to maintain the server control as it is. So I use the ViewState to
    handle it.
    But ViewState is only for having the value of control and the control.
    Then how to do it?. Is there any other way?.

    Regards
    -Gopi


    Disclaimer Information contained in this E-MAIL being proprietary to Scape
    Velocity, Inc is 'privileged', 'confidential' and intended for use only by
    the individual or entity to which it is addressed. Any use or dissemination
    of any information contained in the E-MAIL beyond that necessary to conduct
    business with Scape Velocity, Inc. is strictly prohibited, except as may be
    agreed to in writing between Scape Velocity and you or your organization. If
    the reader of this message is not the intended recipient or agent
    responsible for delivering this message to the intended recipient, you are
    hereby notified that any dissemination, distribution, or copying of this
    communication is prohibited. If you have received this communication in
    error, please notify us immediately and delete this email. Scape Velocity,
    Inc ------------------------------------------------------------------------
    -- Global Software Development at the speed of 'e'
    J Gopinath, Jun 2, 2004
    #1
    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 Saunders
    Replies:
    0
    Views:
    712
    John Saunders
    Aug 29, 2003
  2. John Timney \(Microsoft MVP\)

    Re: Listbox filled with Javascript does NOT maintain viewstate

    John Timney \(Microsoft MVP\), Aug 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    569
    John Timney \(Microsoft MVP\)
    Aug 29, 2003
  3. DC Gringo

    maintain viewstate in listboxes

    DC Gringo, Nov 7, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,091
    DC Gringo
    Nov 9, 2004
  4. Dominic
    Replies:
    5
    Views:
    4,753
    John M Deal
    Nov 19, 2004
  5. Thijs
    Replies:
    2
    Views:
    114
    Brenda
    Dec 4, 2003
Loading...

Share This Page