P
Peter Kirk
Hi there
I am trying to write some "web user controls" which I want to include on an
aspx.
In my VS2005 solution I have a project with my aspx, and another project
with my user controls (ascxs). But I can't compile my solution because the
aspx complains that it can see the ascxs. I get an error like:
Element 'MyControl' is not a known element. This can occur if there is a
compilation error in the Web site.
File 'MyControl.ascx' was not found.
Do the ascxs have to sit in the same project as the aspx?
My aspx looks like this:
<%@ Register TagPrefix="uc" TagName="MyControl" Src="MyControl.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="ControlTest.aspx.cs"
Inherits="alphasolutions.web.control.test.ControlTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Input</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:MyControl id="a_control" runat="server" />
</div>
</form>
</body>
</html>
Thanks,
Peter
I am trying to write some "web user controls" which I want to include on an
aspx.
In my VS2005 solution I have a project with my aspx, and another project
with my user controls (ascxs). But I can't compile my solution because the
aspx complains that it can see the ascxs. I get an error like:
Element 'MyControl' is not a known element. This can occur if there is a
compilation error in the Web site.
File 'MyControl.ascx' was not found.
Do the ascxs have to sit in the same project as the aspx?
My aspx looks like this:
<%@ Register TagPrefix="uc" TagName="MyControl" Src="MyControl.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="ControlTest.aspx.cs"
Inherits="alphasolutions.web.control.test.ControlTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Input</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:MyControl id="a_control" runat="server" />
</div>
</form>
</body>
</html>
Thanks,
Peter