Passing Data Around in ASP.NET

  • Thread starter Thread starter Glenn
  • Start date Start date
G

Glenn

I am an old ASP developer that has begun porting existing apps to ASP.NET.

I am currently working on a wizard dialog that contains about 4 pages. In
ASP in order to keep track of user entered data on the various wizard pages
I had to manually create hidden form fields and pass these between pages.
The form action either went to the next or previous page in the dialog,
depending on whether NEXT or BACK button was pressed. All validation was
done in client side script.

Should I emply the same techniques in ASP.NET, or is there a more efficient
way.

My initial thoughts were to write a custom class capable of storing the
wizard dialog info and instantiate it as session var. Whenever a dialog
button is clicked I will update this structure via a postback server event,
and then move onto the next/prev page using the Response.Redirect or
Response.Transfer.

Am I on the right track?

Thanks,

G.
 
Glenn said:
I am an old ASP developer that has begun porting existing apps to ASP.NET.

I am currently working on a wizard dialog that contains about 4 pages. In
ASP in order to keep track of user entered data on the various wizard pages
I had to manually create hidden form fields and pass these between pages.
The form action either went to the next or previous page in the dialog,
depending on whether NEXT or BACK button was pressed. All validation was
done in client side script.

Should I emply the same techniques in ASP.NET, or is there a more efficient
way.

My initial thoughts were to write a custom class capable of storing the
wizard dialog info and instantiate it as session var. Whenever a dialog
button is clicked I will update this structure via a postback server event,
and then move onto the next/prev page using the Response.Redirect or
Response.Transfer.

Am I on the right track?

Thanks,

G.

Sounds like a good initial approach, a little more OO than your previous
ASP approach so a little cleaner. Another way I always try to see if it
will work initially, is to use one page with multiple panels, as panels
seem intuitively to lend themselves to this app beautifully (turn one
panel on, then after they enter, turn on the next, etc.). The only
problem is the size of ViewState. If the panels are complex or contain
a number of fields, the ViewState can get to be too much. But you could
also play with selectively enabling ViewState.

Then you don't have to pass anything from page to page....

So if this wouldn't cause ViewState problems, I'd look at using Panels.
Otherwise your approach seems to be just fine...
 
Hi Glenn,

Thank you for using MSDN Newsgroup. I am Luke and I am review this issue
currently. As I understand, your ASP.NET application is like Wizard which
need to keed data between pages. I think your initial thought about session
is the most common way can use. Besides this, we also can use Application
variant, Viewstate, cookies and hidden fields. If the data shared between
pages are not large, session varaint should be the most easiest way to
achieve.


Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top