My current web app works fine locally and on live, what i am currently playing around with is compiling my Web App with the Visual Studio Option "Add Web Deployment Project" so all the code behind is compiled into DLL's.
There's is one particular build error i can not get rid off
Error 50 The type or namespace name 'usercontrols_calendarcell_ascx' does not exist in the namespace 'ASP' (are you missing an assembly reference?) c:\page.ascx.cs 30 1 test_deploy
And the actual line of code is as follows :
protected ASP.usercontrols_calendarcell_ascx[] calendarCells;
The problem comes from the fact that the namespace ASP is a 'pseudo' namespace, which can't be referenced when compiling.
The solution I found was to actually integrate the current namespace into the usercontrol definition. I adapted the names of the elements to your naming conventions, but I don't know anything about the namespace you used. Therefore I just named it 'Project.NameSpace'.
In the calendarcell.ascx file:
<%@ Control Language="C#" AutoEventWireup="true" Codefile="calendarcell.ascx.cs" Inherits="Project.NameSpace.usercontrols_calendarcell" %>
In the calendarcell.ascx.cs file:
namespace Project.NameSpace
{
public partial class usercontrols_calendarcell : System.Web.UI.UserControl
{
In the page.ascx.cs file:
using Project.NameSpace;
Hope this helps. In my case it did the trick perfectly.
You can expose Control properties used on page to some interface (e.g. ICalendarCell) and place it in App_Code. Implement interface to your control and use interface in .cs file instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With