Control 'dg 'of type' gridview 'must be placed inside a form tag with runat = Server

Source: Internet
Author: User

The following error occurs when importing data to excel in the gridview:

Control "DG" of Type 'gridview 'must be placed inside a form tag with runat = Server

This function is missing after searching the online data:

Public Override VoidVerifyrenderinginserverform (ControlControl)

{

// Base. verifyrenderinginserverform (control );

}

If no page is set for your gridview, it can be executed normally. However, if the page is set, another problem will soon be encountered!

Another error occurs after compilation and execution,The following error message is displayed:

RegisterforeventvalidationCan only be called during render ();

 

To solve this problem, you can set the following two settings in the original aspx file <% PAGE %>.

Enableeventvalidation = "false" autoeventwireup = "true"

after the above two statements are added to the ASPX page, they are executed normally.

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.