ASP. NET: the current context does not contain the XX control.

Source: Internet
Author: User

The frontend and backend are separated during system modeling. When the integration interface is later added, the following ASP. NET error is prompted: the current context does not contain the name "fileupload1 ":

Cause of error: add the aspx file of another website directly from the current website, and there is aspx under the aspx file of the original website. CS and designer. CS. After being added, only aspx is available under Aspx. CS:


  • Solution 1

  • Solution 2

Delete the page file, manually create a file with the same name in Vs, and then separate the code in aspx and Aspx. copy the code in CS back, (designer. the Code vs in CS will be generated by itself ).

  • Solution 3

Open the designer. CS file and register the control. For example, the ID of the Textbox Control to add HTML is txtadminname, as shown below:

/// <Summary> /// txtadminname control. /// </Summary> /// <remarks> /// automatically generated field. /// To modify the field declaration, move the field declaration from the designer file to the code hidden file. /// </Remarks> protected global: system. Web. UI. htmlcontrols. htmlinputtext txtadminname;

  • Vs smart prompt disappears: you can press Ctrl + J to call up the smart prompt or restart.

Convert web forms to Web Applications

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.