views:

486

answers:

2

Quick info: I'm using latest release of .NET 2.0, and the following is a stripped down test page I wrote to reproduce the error.

Excluding header bits, (there is no included/inline css or javascript) My content page looks like this:

<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="server">
<div>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
    <asp:TextBox ID="txtStuff" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtStuff" Display="None" ErrorMessage="need to fill it with words">  </asp:RequiredFieldValidator>
    <asp:Button ID="bClick" runat="server" Text="Kerlick" />
</div>
</asp:Content>

My Master page (excluding header bits) looks like this:

<body>
<form runat="server" id="Form1">
                <div>
                    <asp:ContentPlaceHolder ID="cphMain" runat="server">
                    </asp:ContentPlaceHolder>
                </div>
                <div id="end">

                </div>
</form>
</body>

On clicking the button, the page throws an "Microsoft JScript runtime error: Object doesn't support this property or method" error, in WebResource.axd in the function ValidationSummaryOnSubmit(validationGroup) (line 512).

Turns out, if I change the id of the div with ID="end" to something other than "end" it fixes the problem.

Now, I've fixed this problem, but I'm interested as to why this would break in the first place?

Is it possible that the validation summary renders a div with the same ID and is getting confused somewhere?

+1  A: 

One way to find out for sure.

Load up firebug, call the validationsummary and explore the page to see what new elements were added.

Normally a duplicate ID will not create an issue, plus you don't have runat server set so it's not a server side control.

Very interesting

thismat
A: 

Thanks for the suggestion, I'll give that a go when I get a chance :)

But you're right, I thought it was very odd indeed.

Zeus