Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 31st, 2004, 09:16 PM
Friend of Wrox
 
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default ViewState with Server.Transfer

Hi,

I'm doing my own form validation, and if the validation fails, I use a Server.Transfer method to send control back to the originating form.

Once there, the load event handler will see that an error flag has been set and tell the user what they did wrong.

Only problem is all the form's textbox controls go blank after the form reloads, even though their EnableViewState properties are set to True. My question is this:

Is Server.Transfer the wrong method to return control back to the originating form? If so, what is the preferred method?

Do I need to set each control's Text property on page load, kind of like I used to do in classic ASP?

Thanks for your help in advance!

HAPPY NEW YEAR!!!

Aaron

 
Old January 1st, 2005, 09:17 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;and if the validation fails

What do you mean by this? I assume the validation doesnt fail but the user fails to complete a field?

IMO you should be using JavaScript to validate forms. This way it is done on the client side, server side validation is not smart on resources. Do you realize everytime the user hits submit a trip to the server is complted? If you have 20 fields in a form, there is a possibility of 20 trips to the server to ensure the form is complete (assuming a non savy web user - there are lots of these) If you use JS even a non savy web user will only make one trip to the server.

Anyhow:
The Server.Transfer method also has a second parameter. If you set this to True, using a statement such as Server.Transfer("pageName.asp", True) the existing query string and any form variables will still be available to the page you are transferring to.

;;;Do I need to set each control's Text property on page load, kind of like I used to do in classic ASP?

This is the classic ASP forum

Wind is your friend
Matt
 
Old January 2nd, 2005, 12:00 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks.

I am actually using client-side validation in addition to server-side. The server-side stuff is a) a backup to the client side stuff (for people who have JavaScript turned off), and b) for some more complicated stuff not availible on the client side, such as checking passwords against a database etc.

Anyway, I am using the True paramater with Server.Transfer. Still not working.

Also, sorry, I didn't know this was a classic ASP forum.

Aaron

 
Old January 2nd, 2005, 07:52 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Is your:
;;;b) for some more complicated stuff
on the same page as your initial form or do you post to another page?

I would put it all on the same page inside a condition that only runs when submit is clicked, then place the each posted value inside the value="" section of its field - Now use your server.transfer or response.redirect after all your validation is done.

;;;not availible on the client side, such as checking passwords against a database etc.

BTW:
JS is for checking 'is there a value' or 'is the value the correct data type' etc... Once all these conditions are true the form gets posted (and not until) then of course you check the UN and PW on the server side. I guess what i'm trying to say is 'do as much validation as possible on the client side'

Wind is your friend
Matt




Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Side Viewstate in ASP.NET 2.0 vikaspatyal ASP.NET 2.0 Professional 1 December 18th, 2007 12:26 AM
Server.Transfer Sheraz Khan ASP.NET 2.0 Basics 1 July 28th, 2007 05:17 AM
Transfer Data from one server to another server Jane SQL Server 2000 2 February 28th, 2005 03:15 AM
SSL and server.transfer shs BOOK: Beginning ASP.NET 1.0 2 September 1st, 2004 09:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.