在网络应用程序中有一个 .aspx 页面,其中doesnt have the code behind file(.cs)
. 它位于名为staticcontent
以下的文件夹中是 aspx 的标记
<%@ Page Title="" Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
</head>
<body>
<form action='searchdata.aspx' method='post'>
<input type='text' value='' id='searchText' />
<button id='btnSearch'>Search</button>
</form>
</body>
</html>
现在我想将此搜索文本框移动到 asp.net 并在此页面中注册。
但是它似乎没有被编译。
它仍然只呈现用户控件的语法
<%@ Register Src="~/controls/EmpSearch.ascx" TagName="search" TagPrefix="emp" %>
<emp:search runat="server" ID="searchCtrl"></emp:search>
呈现的 HTML
<body>
This contains only static text and there is no dynamic data
Employee Search
<emp:search runat="server" ID="searchCtrl"></emp:search>
</body>
尝试使用<!--#include file="~/controls/EmpSearch.ascx"-->
没有影响。
.aspx 页面怎么没有在这里编译。
这.csproj has only <Content Include="StaticContent\Employee.aspx" />
并且没有
<Compile Include="StaticContent\Employee.aspx.cs">
因为它没有后面的代码