Error retrieving Error-Server tags cannot contain <% ...%> constructors

<input id="tbxPopupCode" type="text" runat="server" value="<%= Request.QueryString["code"].Replace("-"," ") %>" />

I get an error message:

Server tags cannot contain <% ...%> constructs

I need to replace the value from Request.QueryString["code"]and bind it to the text value.

+5
source share
2 answers

Actually, the exception message is pretty clear: you cannot have runat="server"and <%= %>.

There are some labor costs for this (for example <%# %>), but why not just set a value for the code like this.tbxPopupCode.Value = ...?

+16
source

, , , HTML- PlaceHolder.

+1

All Articles