Does anyone have an example (code or a link) that will allow me to export a gridview template field to excel? Here is an example of what I mean. Assume I have the following GridView Declaration:
<asp:GridView Id="gvResults" runat="server">
<Columns>
<asp:TemplateField HeaderText="Contact Info">
<ItemTemplate>
<b>Name:</b><%# Eval("Name") %><br/>
<b>Address:</b><%# Eval("Address") %><br/>
<b>Phone:</b><%# Eval("Phone") %><br/>
<b>E-mail:</b><%# Eval("Email") %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
When I export to excel, I want to export the fields in the template field to columns in the excel file, so it will look similar to this:
Name Address Phone E-mail
==== ======= ==== =====
John 123 Rd 40330 [email protected]
Mark 456 St 22039 [email protected]