Getting error Error-Server tags cannot contain <% ... %> constructs

asp.net, c#, javascript, jquery

Solution

Actually, the exception message is pretty clear: You can not have `runat="server"` and `<%= %>`.

There are some workarouns for this (eg `<%# %>`), but why not simply setting the value on the code-behind like `this.tbxPopupCode.Value = ...`?

Problem

``` <input id="tbxPopupCode" type="text" runat="server" value="<%= Request.QueryString["code"].Replace("-"," ") %>" /> ``` I m getting an error: Server tags cannot contain <% … %> constructs I need to replace the value from `Request.QueryString["code"]` and bind into textbox value.

Original source

Related problems