I ran into the error: Cannot get inner content of ExportDiv because the contents are not literal I did a search and got this very useful resource!
I know I used server controls in my aspx page. The page fetches data dynamically from the database. How can I export this data to excel given that there're server controls in my html page.
Here're some of the site.aspx code to the page
    <form id="form1" runat="server">
    <div runat="server" id="ExportDiv">
        <asp:Panel ID="ResultsPanel" runat="server">
        <table cellpadding="0" class="style1">
            <tr>
                <td class="style2">
                    <asp:DetailsView ID="DetailsView1" runat="server" CellPadding="4" 
                    </asp:DetailsView>
                </td>
                <td>
                    Poor</td>
                <td>
                    Good</td>
                <td class="style3">
                    Very Good</td>
                <td>
                    Total Responses</td>
                <td>
                    Average Score</td>
            </tr>
            <tr>
                <td class="style2" colspan="6" bgcolor="#CCCCCC">
                    1. How would you rate the food served to you?</td>
            </tr>
            <tr>
                <td class="style2">
                       a.) Overall Quality Taste and Flavour.<br />
                       b.) Variety of Food.</td>
                <td>
                    <asp:Label ID="lblResult0" runat="server" Text="Label"></asp:Label><br/>
                    <asp:Label ID="lblResult3" runat="server" Text="Label"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="lblResult1" runat="server" Text="Label"></asp:Label><br/>
                    <asp:Label ID="lblResult4" runat="server" Text="Label"></asp:Label>
                </td>
                <td class="style3">
                    <asp:Label ID="lblResult2" runat="server" Text="Label"></asp:Label><br/>
                    <asp:Label ID="lblResult5" runat="server" Text="Label"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="aveNum0" runat="server" Text="Label"></asp:Label>
                    <br/>
                    <asp:Label ID="aveNum1" runat="server" Text="Label"></asp:Label>
                    <br/>
                </td>
                <td>
                    <asp:Label ID="aveScore0" runat="server" Text="Label" style="font-weight: 700"></asp:Label>
                    <br />
                    <asp:Label ID="aveScore1" runat="server" Text="Label" style="font-weight: 700"></asp:Label>
                    <br/>
                </td>
            </tr>
           </table>
        </asp:Panel>
    </div>
                    <asp:GridView ID="gvSurveyResult" runat="server">
    </asp:GridView>
    <asp:GridView ID="GridView1" runat="server">
    </asp:GridView>
    </form>
</body>
And here's also the site.aspx.cs code
    Response.AppendHeader("content-disposition", "attachment;filename=ExportedHtml.xls");
    Response.Charset = "";
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.ContentType = "application/vnd.ms-excel";
    this.EnableViewState = false;
    Response.Write(ExportDiv.InnerHtml);
    Response.End();
All answers would be welcomed!
 
     
     
    