views:

104

answers:

1

I'm doing some databinding inside a ListView ItemTemplate, but I suspect this is a problem for any databinding/template situation. I want to write 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!

+3  A: 

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") %>' />
Nick Craver
gah! so simple. Thanks!
Barry Fandango