I have this statemen at the beginning:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucCreditCard.ascx.cs"
Inherits="UserControls_Common_ucCreditCard" %>
in ucCreditCard.ascx.cs I have this:
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class UserControls_User_ucCreditCard : System.Web.UI.UserControl
{
//
}
When I try to reference any of the simple control like Textbox etc, I always get control 'xxx' does not exist in current content. What can be the problem?
Thanks in advance :)
Same problem here, but with a User Control. Now solved.
In my case, the issue was the designer file being generated in a different namespace than the main one rather than just a missing file. Don't ask me how it happened.
Using different form and user control name will solve your problem.
I just ran into this after I copied/pasted an ascx user control for which I'm going to make a breaking change and it needed to be "versioned". I had adjusted the class names but the references to page controls on the original ascx code behind still barfed until I made sure the full namespace.classname was being used in the ascx page "Inherits" property.
There is another situation when you get this error. It is when multiple aspx pages refers to the same code page. This generally happens when you have made a copy of the page and then changed the page name but forgot to change the inherits tag.
To find out this just search the text inside the inherits tag, in the whole project and if there is more than one occurrence of the text in aspx pages then just do the modification accordingly.