Solution to Viewstate for Contols in Panel

J

JDP@Work

Unless I'm mistaken, I've found the following condition and ONE LINE solution to
clear controls in a panel.

Me.pnlAddUpdate.EnableViewState = False

Using the same panel of fields for both Update and New; that after first doing
an update, ViewState retains the values when starting a new process that is
supposed to have empty fields.

Details....

Manage Users page enables admin and power users to create and disable logins.

Power users can only create standard users in their market center, therefore the
field displays in a lable and the security role is automatically set to a
standard user.

I use a panel with fields and control their visibility in the code behind.

The problem occurs when I select an existing login and the fields populate with
the correct data, clicking Save/Update or Cancel returns to the datagrid,
HOWEVER when I then select New and render the panel, the fields are NOT blank
but have the last user's info.

So.....

To Add a New User....

Me.pnlAddUpdate.EnableViewState = False
Me.pnlUsersList.visible = False
Me.pnlAddUpdate.visible = True


To Update an Existing User....

Me.pnlAddUpdate.EnableViewState = True
Me.pnlUsersList.visible = False
Me.pnlAddUpdate.visible = True


HTH

JeffP....
 

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

Forum statistics

Threads
474,141
Messages
2,570,816
Members
47,361
Latest member
RogerDuabe

Latest Threads

Top