您可以使用导航栏切换顶点 [英] You can use the navigation bar to switch contex

查看:77
本文介绍了您可以使用导航栏切换顶点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ASP.net网站上工作,在我的一种形式中,我添加了HTML控件,而在文件后面的代码中使用该控件时,出现了我无法理解的错误.

i'm working on ASP.net web site , in one of my forms i added HTML control , while using that control from the code behind file i got wiered error which i can't understand .

  <table style="width: 100%;" class="table-responsive">
            <tr>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                     <input id="UserName" runat="server" type="text" class="form-control" placeholder="Username" required="required"/>
                </td>
            </tr>
            <tr>

codeBehind文件:

codeBehind file :

protected void Page_Load(object sender, EventArgs e)
{
   
}
public void signupData()
{
    string s = UserName.text;
}

错误图片

推荐答案

当两个前端文件引用一个后端类时,就会出现此消息.

This message can occur when two front end files reference a single back end class.

例如,您可能有两个前端文件,分别为: signup.ascx signupLight.ascx

For example you could have two front end files called: signup.ascx and signupLight.ascx

这些文件然后引用共享的后端代码文件: signup.ascx.cs

These files then reference a shared back-end code file: signup.ascx.cs

在将控件添加到一个前端文件而不是另一个文件时会出现问题.

The problem arises where you add a control to one of the front end files but not the other.

例如您的示例中的 UserName HtmlInputText 控件可能存在于 signup.ascx 中,但不存在于 signupLight.ascx 中,因此当您在 signup中引用它时.ascx.cs 表示缺少参考之一.

e.g. The UserName HtmlInputText control in your example could exist in signup.ascx but not signupLight.ascx so that when you reference it in signup.ascx.cs it is showing that one of the references is missing.

如果通过使用其他文件名进行复制但不添加 .exclude 文件扩展名来备份前端文件,则可能会发生另一个示例.然后,这将干扰尝试在后端引用新的前端控件,因为codefile标签仍指向后面的实时代码.

Another example could happen if you make a backup of the front end file by making a copy with a different filename but not adding the .exclude file extension. This will then interfere with trying to reference new front end controls in the back end, as the codefile tag is still pointing at the live code behind.

不幸的是,visual studio强调了这一点,因为它需要切换上下文并显示两个相同项目的名称,而不是引用起源的实际文件,因此您可能必须在项目中搜索后端文件名以查找所有活动的前端文件被引用的位置.

Unfortunately visual studio highlights this as needing to switch context and showing the names of two identical projects rather than the actual file where the reference originated, so you may have to do a search in your project for the backend filename to find all the active front end files where they are referenced.

这篇关于您可以使用导航栏切换顶点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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