Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validation Summary not showing for client side validation

Reply
Thread Tools

Validation Summary not showing for client side validation

 
 
cwhankey@gmail.com
Guest
Posts: n/a
 
      12-12-2008
When I enter a non-date in the text box of the sample page show below
and then tab off, the red * shows next to the text box. However, the
error message does not show up in the validation summary until I click
the button. Is there a way that I can get the validation summary to
display the error message when I tab off of the text box?



<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default3.aspx.cs" Inherits="Default3"
EnableEventValidation="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />&nbsp;
<asp:TextBox ID="TextBox1" runat="server"
CausesValidation="True"></asp:TextBox>&nbsp;&nbsp;
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToValidate="TextBox1"
ErrorMessage="value not a date" Operator="DataTypeCheck"
Type="Date">*</asp:CompareValidator><br />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" /
>

</div>
</form>
</body>
</html>
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      12-12-2008
this by design. the validation own message span is updated on lost
focus. the validation summary is only updated at start of postback. if
you look at the validation client code, you'll see its pretty simple. i
tried this once, and the visual effect wasn't the best. plus you really
need to run all the validators.

note: the code is not structured very well for modification, so you will
need to duplicate code.

-- bruce (sqlwork.com)

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> When I enter a non-date in the text box of the sample page show below
> and then tab off, the red * shows next to the text box. However, the
> error message does not show up in the validation summary until I click
> the button. Is there a way that I can get the validation summary to
> display the error message when I tab off of the text box?
>
>
>
> <%@ Page Language="C#" AutoEventWireup="true"
> CodeFile="Default3.aspx.cs" Inherits="Default3"
> EnableEventValidation="true" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:Button ID="Button1" runat="server" Text="Button" />&nbsp;
> <asp:TextBox ID="TextBox1" runat="server"
> CausesValidation="True"></asp:TextBox>&nbsp;&nbsp;
> <asp:CompareValidator ID="CompareValidator1" runat="server"
> ControlToValidate="TextBox1"
> ErrorMessage="value not a date" Operator="DataTypeCheck"
> Type="Date">*</asp:CompareValidator><br />
> <asp:ValidationSummary ID="ValidationSummary1" runat="server" /
> </div>
> </form>
> </body>
> </html>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
Using both server side validation and client side validation =?Utf-8?B?dmlkeWE=?= ASP .Net 1 06-02-2005 09:45 PM
ASP.NET Web Forms Validation Controls are Server-Side or Client-Side Validation? Matt ASP .Net 14 01-30-2004 09:15 AM
validation summary doesnt display when there's client-side validation Libs ASP .Net 0 06-25-2003 03:05 PM



Advertisments