Wrox Programmer Forums
|
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 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 22nd, 2008, 10:20 AM
Registered User
 
Join Date: Dec 2008
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default How to use the CausesValidation property of TextBox on earth?

Code:
<div>
    Please enter an email adress:<br />
        <asp:TextBox ID="TextBox1" runat="server"  CausesValidation="False"></asp:TextBox>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
            ErrorMessage="RegularExpressionValidator" ControlToValidate="TextBox1" 
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">you must 
        enter an valid email adress</asp:RegularExpressionValidator>
        <br />
    </div>
why the page also causes an validation when textbox loses its crusor while CausesValidation="False"??
Appreciate your answers!
 
Old December 23rd, 2008, 12:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, on earth the CausesValidation property behaves differently from what you expect:

From: http://msdn.microsoft.com/en-us/libr...alidation.aspx

Quote:
Gets or sets a value indicating whether validation is performed when the TextBox control is set to validate when a postback occurs.
Instead, you may want to look at the EnableClientScript property of the validator....

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
chuxu (December 25th, 2008)





Similar Threads
Thread Thread Starter Forum Replies Last Post
changing the backcolor property of the textbox Fehrer Access VBA 9 April 19th, 2016 10:59 AM
Virtual Earth with TBH??? BradenBR BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 November 28th, 2006 01:38 PM
basic textbox property bem2x Beginning VB 6 1 August 23rd, 2006 11:17 AM
How to set textbox property to readonly when text bekim Classic ASP Basics 1 July 12th, 2005 12:06 AM
TextBox.Text property returns only old value? humour General .NET 9 August 3rd, 2004 07:01 AM





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