Question

What is wrong with this control?

<input value="<%# Eval("WebpartID")%>" type="hidden" 
 runat="server" id="hiddenserverfield" />

I use this hidden input field inside Reapeter. I want to bind it and later use it server side. I get this parser error:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.

I have another hidden input, exactly the same only without runat="server", and it doesn't cause any problems.

Was it helpful?

Solution

Quotes around bound property must be single, not double.

<input value='<%# Eval("WebpartID")%>' type="hidden" 
 runat="server" id="hiddenserverfield" />

If control is not server-side, this doesn't matter at all.

OTHER TIPS

Try this

<asp:HiddenField ID="hiddenserverfield" runat="server" 
                 Value='<%# Eval("WebpartID") %>' />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top