Search code examples
asp.netrepeaterserver-sidehidden-field

Input with type="hidden". The server tag is not well formed


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.


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.