Stack User
Stack User

Reputation: 1398

From gridview to excel export - How can I get excel what I see in the application?

There is a gridview which includes some data.

The header style of that gridview is

<HeaderStyle BackColor="#006699" CssClass="GridViewHeader" Font-Bold="True" ForeColor="White" />

How can I export that gridview to excel? I want to export what I see, colour, filter etc.

when I follow this link gridview to excel

I get error because it says there there should be form tag which includes runat="server" but when I add it, it gives again error because masterpage has already have a form..

Upvotes: 0

Views: 146

Answers (1)

Rishabh
Rishabh

Reputation: 11

Copy and paste this code into your page:

public override void VerifyRenderingInServerForm(Control control)
{
    /* Confirms that an HtmlForm control is rendered for the specified ASP.NET
       server control at run time. */
}

This will solve your issue.

Upvotes: 1

Related Questions