Validation Summary not showing for client side validation

C

cwhankey

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"
</div>
</form>
</body>
</html>
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top