Use IsPostBack for more than one roundtrip

A

AndiRudi

Hi, i am trying to build a wizard control and return to a problem, that I
often get and I wasn't able to solve it so far...

If I habe a Custom Control which uses more than one roundtrip, e.g. a wizard
control with more pages and the next/back Buttons are LinkButtons, I cannot
decide what state the page has.

Think of a "Import" Wizard. Page 1 loads up the csv File. Page 2 dynamically
shows dropdowns of the headlines of the table in the csv and allows the user
to assign his fields on the target table...

Page 1 is easy, the Next Button loads up the file und shows the user the
next page (which is a panel). At this moment, i should dynamically create the
dropdowns. This can be done in the Next_Click Handler for example. But then,
the User selects his field combinations. Each Drop is AutoPostBack=true. He
selectes the first field. Now the Problem is that we have another Event...
(dropdown_selected...) and not Next_Click and there is no way to build the
dropdowns again.

I cannot do this in Page_Load because, the Next-Click event fires after
Page_Load...

Any suggestions?
 
H

Harolds

Override the LoadViewState of the page, and build/rebuild the controls there
when needed.

Protected Overrides Sub LoadViewState(ByVal savedState As Object)
MyBase.LoadViewState(savedState)
if viewstate("LoadControls") & "" = "true" then
CallLoadControls
End if
End Sub
 

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
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top