ASP.Net page does not compile

There is a .aspx page in the web application which doesnt have the code behind file(.cs). it is located in a folder named staticcontentbelow is aspx markup

<%@ 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>

Now I want to move this search text box to asp.net and register on this page.

However, it does not compile.

It still displays the syntax of the user control only

<%@ Register Src="~/controls/EmpSearch.ascx" TagName="search" TagPrefix="emp" %>
<emp:search runat="server" ID="searchCtrl"></emp:search>

Highlighted HTML

<body>
This contains only static text and there is no dynamic data
Employee Search
<emp:search runat="server" ID="searchCtrl"></emp:search>
</body>

Tried to use <!--#include file="~/controls/EmpSearch.ascx"-->inaction.

Why the .aspx page does not compile here.

.csproj has only <Content Include="StaticContent\Employee.aspx" />

and does not have

<Compile Include="StaticContent\Employee.aspx.cs"> 

since he has no code for

+4
source share
1 answer

, , , , staticcontent, :-) asp.net /.

web.config IIS .

dev-:

WebForm1.aspx:

<%@ Page Language="C#"%>
<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc1" TagName="WebUserControl1" %>
<html>
<head>   
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <uc1:WebUserControl1 runat="server" ID="WebUserControl1" />
    </form>
</body>
</html>

WebUserControl1.ascx:

<%@ Control Language="C#"%>
<asp:TextBox runat="server" ID="tbSearch"></asp:TextBox>
<asp:Button runat="server" Text="Search"/>
+3

All Articles