Koteswararao Mallisetti

Koteswararao Mallisetti

  • NA
  • 1.1k
  • 467.6k

exporting the gridview data to excel sheet error

Oct 7 2010 9:32 AM

hi,

i am using master page and child pages in the child page

i want to export the gridview data to excel sheet for this i use the following code

       Response.ClearContent();

        Response.AddHeader("content-disposition", "attachment; filename=shedules.xls");

        Response.ContentType = "application/excel";

        StringWriter sw = new StringWriter();

        HtmlTextWriter htw = new HtmlTextWriter(sw);

        grdshedules.RenderControl(htw);

        Response.Write(sw.ToString());

        Response.End();

but in the gridShedules.RenderControl(htw) i got the following error but the form tag with  runat= server is already in the master page how to solve this issue

error:Control 'ctl00_ContentPlaceHolder1_grdshedules' of type 'GridView' must be placed inside a form tag with runat=server.


Answers (1)