Exporting data from ASP.net to Excel

Source: Internet
Author: User
Tags print format stack trace

When the ASP.net program involves data display when most will require printing, and the page on the print format is often not meet the needs of the often used method is to import into Excel and then print. (as if this is already a cliché) today on the Internet to search a piece of printed code, feel good, need to print friends can see.

Some of the code on the web is basically similar to the principle, there is also a problem, is:

The control "Ctl00_center_gridview1" of type "GridView" must be placed inside a form tag that has a runat=server. Note: An unhandled exception occurred during the execution of the current WEB request. Check the stack trace for more information about the error and where the error occurred in the code. Exception Details: System.Web.HttpException: The control "ctl00_center_gridview1" of the type "GridView" must be placed inside a form tag with Runat=server.

The error description is that I'm commenting that this procedure is a false quote,

//public override void VerifyRenderingInServerForm(Control control)
//{
// //base.VerifyRenderingInServerForm (control);
//}

Related Article

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.