简体   繁体   English

使用ASP.NET,为什么会发生错误:服务器标记的格式不正确

[英]Using ASP.NET, Why here an error occurs: The server tag is not well formed

<input type="text" class="inputField" id="searchName" value="XIA"/>
<asp:Button ID="Button1" runat="server" Text="Search" OnClientClick="window.location.replace('<%#ResolveUrl("~")%>/'+$('#searchName').val()); return false;" />

I want to redirect to a certain page based on the ~ directory and user input. 我想根据~目录和用户输入重定向到某个页面。

It's this bit here. 这是这里。

OnClientClick="window.location.replace('<%#ResolveUrl("~")%>/'+$('#searchName').val()); return false;" 

You've got double quotes and single quotes throughout the expression cause an early string termination. 在整个表达式中,双引号和单引号会导致字符串提前终止。

You should make that a function and pass the data into it. 您应该使该函数并将数据传递给它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM