How to maintain the viewstate in server control?

J

J Gopinath

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'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top