I am trying to add a table in aspx page and need to have access to the table cells in .cs file. Created AspNet:Table with some rows and cells but keep getting ‘not a valid identifier’ error and can’t see why:
<asp:Table runat="server" ID="tblStatus" Width="920" CellPadding="0" CellSpacing="0">
<asp:TableRow>
<asp:TableCell runat="server" ID="LM6-D7-L"></asp:TableCell>
At the table cell row, I get:
Build (web): 'LM6-D7-L' is not a valid identifier.
Build (web): Literal content ('</asp:TableCell>') is not allowed within a 'System.Web.UI.WebControls.TableCellCollection'.
This happens for every row in the table.
ASP.NET doesn’t accept an identifiers with dashes in. You have to change the dashes to underscores or something else:
Or:
Etc.