Solved

Turn off validation on Return

Posted on 2003-12-08
2
217 Views
Last Modified: 2010-04-16
I have a Return button that redirects if clicked but if the user hit the submit button and generated validator errors before that, the Return button just sits there.   I think I have to use unload, but don't know how.
0
Comment
Question by:dcass
2 Comments
 
LVL 7

Expert Comment

by:TransBind
ID: 9900462
I think it has something to do with the way you structured your code. When a Button, LinkButton, or ImageButton Web server control is clicked, the current page is submitted to the server, where it is processed. The button always posts the page to the server. When you click your return button if its a server control button your validators will be checked/errored. Try to make that button a regular html button/javascript or experiment with this:

private void Page_Load(object sender, System.EventArgs e)
{
   if (!IsPostBack)
   {
      // Evals true first time browser hits the page.
   }
   else
   {
      // This is called if the form has been posted back, possibly
      // by a button click.
      this.Label1.Text = "You clicked a button.";
   }
}


0
 
LVL 18

Accepted Solution

by:
testn earned 125 total points
ID: 9903418
you can add a property to your control to avoid the client side validation....

<asp:button runat=server id=btnReturn text="Return" causesvalidation=false />
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now