Web App Compiling Error - ASP.NET Reference

让人想犯罪 __ 提交于 2019-12-05 19:59:54

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'.

  1. In the calendarcell.ascx file:

    <%@ Control Language="C#" AutoEventWireup="true" Codefile="calendarcell.ascx.cs" Inherits="Project.NameSpace.usercontrols_calendarcell" %>

  2. In the calendarcell.ascx.cs file:

    namespace Project.NameSpace
    {
    public partial class usercontrols_calendarcell : System.Web.UI.UserControl
    {

  3. 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.

I am guessing here, but it looks like your calendarcell user control is not compiling properly.

When this happens your deployment project is probably using an old dll that does not contains that class.

Try to compile you project, and when you are able to do that with no errors compile the deployment project.

You need to make sure that you compile page.ascx.designer.cs as well.

Do you have it correctly referenced in in the aspx page?

I mean this part

(Should be a similar tag in your aspx page and the SRC should refer to where the calendar control is.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!