Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 September 5th, 2007, 11:01 AM
Authorized User
 
Join Date: Apr 2006
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
Default RequiredFieldValidator and Redirect

I am using a the RequiredFieldValidator and have run across a small problem.

If I put in a quantity, it adds to the cart and redirects me back to the catalog page, just like it's supposed to.

If I don't put in the quantity, it sends the error message to the screen (like it's supposed to), but once I add a quantity in and click the submit button, it remains on the item page, though it does add the item into the cart.

I'm missing something about the RequiredFieldValidator and getting it to Redirect. Here is the code.

Quantity<br><asp:textbox id="ItemQuantity" size="1" runat="server" /><br>
<asp:RequiredFieldValidator id="rfvItemQuantity" ControlToValidate="ItemQuantity" Text="A Quantity is required!" runat="server" /><br><br>
<asp:Button id="btnAddToCart" Text="Add to Cart" OnClick="AddToCart" runat="server" />

And the Redirect code.

Response.Redirect("http://www.mystore.come/OrderForm.aspx")


 
Old September 13th, 2007, 07:09 PM
Authorized User
 
Join Date: Mar 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to show your AddToCart event handler code. I'm assuming that is where you have placed your Response.Redirect code, if not then that is where you should put it.






Similar Threads
Thread Thread Starter Forum Replies Last Post
RequiredFieldValidator bnorg ASP.NET 1.0 and 1.1 Basics 3 April 24th, 2006 10:00 PM
RequiredFieldValidator g2000 ASP.NET 2.0 Basics 1 December 22nd, 2005 06:23 PM
RequiredFieldValidator GuyB ASP.NET 1.0 and 1.1 Basics 1 November 23rd, 2005 03:11 PM
requiredfieldvalidator suzila ASP.NET 1.0 and 1.1 Basics 5 January 9th, 2004 08:19 AM





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