我收到一个错误: Server tags cannot contain constructs 我需要替换 Request.QueryString["code"] 中的值并绑定(bind)到-6ren">
gpt4 book ai didi

c# - 获取错误 Error-Server tags cannot contain <% ... %> constructs

转载 作者:数据小太阳 更新时间:2023-10-29 05:42:49 24 4
gpt4 key购买 nike

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

我收到一个错误:

Server tags cannot contain <% … %> constructs

我需要替换 Request.QueryString["code"] 中的值并绑定(bind)到文本框值中。

最佳答案

其实异常信息很清楚:你不能有 runat="server"<%= %> .

有一些解决方法(例如 <%# %> ),但为什么不像 this.tbxPopupCode.Value = ... 那样简单地在代码隐藏中设置值呢? ?

关于c# - 获取错误 Error-Server tags cannot contain <% ... %> constructs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15699895/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com