名称'XXX'不当前环境的用户控件存在 [英] The name 'xxx' does not exist in current context user control

查看:73
本文介绍了名称'XXX'不当前环境的用户控件存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个statemen开头:

I have this statemen at the beginning:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucCreditCard.ascx.cs"
    Inherits="UserControls_Common_ucCreditCard" %>

在ucCreditCard.ascx.cs我有这样的:

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
{
//
}

当我尝试引用任何简单的控制像文本框等,我总是得到控制XXX在当前内容不存在。可以采取什么问题?

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?

在此先感谢:)

推荐答案

希望你缺少设计文件,因为这些错误大多只在这样的情况下发生的,点击右键,转换成Web应用程序。应该做的伎俩。

Hope You are missing the designer file, as these errors mostly occur only in such cases, Right click and convert to web application. should do the trick.

另外做检查,其等同于你的.cs定义的部分类文件

Also do check that its the same as the partial class defined in your .cs file

这篇关于名称'XXX'不当前环境的用户控件存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆