Solved

Turn off validation on Return

Posted on 2003-12-08
2
219 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How would you add MULTITHREADING to the attached C# code? 4 62
Problem!!! 8 33
Example works but why do I need to click twice on button 4 42
.NET 2008 VB and C# 6 28
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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