在Web的applcation存在的.aspx页面其中doesnt have the code behind file(.cs)
。它是在叫staticcontent
的文件夹下面是ASP.Net页面是没有得到编译
<%@ 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,该页面中注册的aspx的标记。
但是它没有得到编译它似乎。
它仍然呈现的用户控件只
<%@ 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">
,因为它不具有背后
如果你还没有代码隐藏,这是未编译,请阅读页面生命周期! –
@RameshRajendran代码后面是可选的只有,读[这里](http://msdn.microsoft.com/en-us/magazine/cc163512.aspx)'ASP.NET,从版本1.0。正如大多数Web开发人员现在应该知道的那样,ASP.NET页面通常以一个或两个文件编写:.aspx标记文件和可选的代码隐藏文件。代码隐藏包含以任何受支持的编程语言编写的类文件,但通常是Visual Basic或C#。 .aspx标记文件包含HTML标记,ASP.NET控件标记和形成页面结构的文字(它也可以包含代码)。 –