获取错误错误 - 服务器标记不能包含<%...%GT;结构体 [英] Getting error Error-Server tags cannot contain <% ... %> constructs

查看:228
本文介绍了获取错误错误 - 服务器标记不能包含<%...%GT;结构体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我米得到一个错误:

I m getting an error:

服务器标记不能包含&LT;%...%>构造

Server tags cannot contain <% … %> constructs

我需要从的Request.QueryString [code] 替换值,并绑定到文本框的值。

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

推荐答案

其实,异常消息为pretty明确:
你不能有 =服务器&LT;%=%&GT;

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

有一些workarouns本(如&LT;%#%&GT; ),但为什么不能简单地设置在code值隐藏像 this.tbxPopup code.Value = ...

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

这篇关于获取错误错误 - 服务器标记不能包含&LT;%...%GT;结构体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆