Hi Lewis,
My name is Allen Chen. It's my pleasure to work with you on this issue.
From your description, when CompareValidator is used the JS function hooked
to onchange event doesn't fire, right?
I did a simple test but it worked fine. Here's my test code:
Aspx:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Test() {
var d = new Date();
document.getElementById("input1").value = d.getTime();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
This input is for test. Don't input value in it.
<input id="input1" />
<br />
TextBox1:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
TextBox2:
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:CompareValidator ControlToValidate="TextBox1"
ControlToCompare="TextBox2" ValueToCompare="Text"
ID="CompareValidator1" runat="server"
ErrorMessage="CompareValidator"></asp:CompareValidator>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>
Aspx.cs:
protected void Page_Init(object sender, EventArgs e)
{
this.TextBox1.Attributes.Add("onchange", "Test()");
this.TextBox2.Attributes.Add("onchange", "Test()");
}
When you input value into TextBox1 and TextBox2 you can see the Test()
function is always called when the value is changed.
Could you compare your code with mine to see if there's any difference? You
can also send me a demo that can reproduce this problem. My email is
(E-Mail Removed). Please update here after sending the project in case
I missed that email.
Regards,
Allen Chen
Microsoft Online Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.