Solved

Turn off validation on Return

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Greetings C# program 17 124
Service Controller 1 27
Hey!! 5 37
InputLanguage 1 33
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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