You can use the navigation bar to switch contex

I work on the ASP.net website, in one of my forms I added an HTML control, using this control from the code behind the file, I got an error that I can not 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 file:

protected void Page_Load(object sender, EventArgs e)
{

}
public void signupData()
{
    string s = UserName.text;
}

error image

enter image description here

+4
source share
3 answers

This message may appear when two front-end files reference the same back-end class.

For example, you may have two interface files: signup.ascxandsignupLight.ascx

These files then refer to a shared internal code file: signup.ascx.cs

The problem occurs when you add a control to one of the frontend files, but not to the other.

. UserName HtmlInputText signup.ascx, signupLight.ascx, , signup.ascx.cs, , .

, , , .exclude. , codefile .

, , , , , , .

+1

You can use the navigation bar to switch context . , , .

( ), ProjectA ProjectB.

0

Visual Studio was giving me the same error. Verify that the front-end files did not reference files with a back-end.

For me, the fix changed from CodeFileto CodeBehindin the associated aspx.cs file. This fixed the error.

0
source

Source: https://habr.com/ru/post/1671465/


All Articles