I have been just using what it wants for years and have never questioned it, however, can someone tell me why I have to use single quote vs double quotes in order to be a well formed tag?
Error Msg:
“The server tag is not well formed.”
What are the rules for the single quote enforcement(ie: within a template…etc)?
//not well formed
<uc1:blaControl ID="bla" runat="server" Prop1="<%# Eval("Data") %>" />
vs
//well formed
<uc1:blaControl ID="bla" runat="server" Prop1='<%# Eval("Data") %>' />
<asp:Literal ID="ControlTitle" runat="server" Text="<%# Title %>" />
<asp:Literal ID="ControlTitle" runat="server" Text='<%# Title %>' />
Well the markup in the first is not valid SGML. The
"inside the attribute are confused with the surrounding quotes so it’s not clear where the attribute begins an ends. To get around this you need to keep them different.The reason you can’t alternatively use the following syntax which would be valid SGML, is that the C# inside the outer quotes becomes invalid and won’t compile (single quotes denote a char).