E Crux
E Crux

Reputation: 83

ASP Parser error "not a valid identifier"

I renamed an id in my site.master file from "safety_audit" to "5why_form". Now I'm getting a Parser Error Message: '5why_form' is not a valid identifier.

The offending code is:

<asp:ContentPlaceHolder id="5why_form" runat="server">
</asp:ContentPlaceHolder>

I just don't know what I've broken here. I thought the syntax for IDs was alphanumeric, and underscores. I'm at a loss.

Upvotes: 2

Views: 4160

Answers (1)

Grant Thomas
Grant Thomas

Reputation: 45083

You can't start an ASP.NET identifier (and, indeed, in many languages/frameworks (and particularly any worth their salt)) with a number. You'll need to change that to a valid identifier, removing the leading 5 makes it so.

Your identifiers are alphanumeric, and so can contain numbers, but can't start with one.

Upvotes: 4

Related Questions