I'm doing some databinding inside a ListView ItemTemplate, but I suspect this is a problem for any databinding/template situation. I want to writ开发者_运维百科e something like:
<asp:HiddenField runat="server" ID="hidPositionID" Value="<%#Eval("PositionID") %>" />
But I get a YSOD with an error message that the server tag is not well formed. How do I persist non-visible data inside my ListViewItem?
Thanks!
Use single quotes (''
) to wrap anything with ""
inside the value so the start/stop pairs match:
<asp:HiddenField runat="server"
ID="hidPositionID"
Value='<%#Eval("PositionID") %>' />
精彩评论