[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to give an Excel file a file name when exporting a GridView to Excel 2003 when using ASP.NET 4.0 with C# and VS2010 ?

Posted on 2013-12-09
3
Medium Priority
?
592 Views
Last Modified: 2013-12-10
I'm writing my first ASP.NET 4.0 application using C# with VS2010.

I am trying to export a stored procedure result set to Excel 2003.

When I create the new Excel file, I noticed that it is named DEFAULT.XLS.

DEFAULT is the name of the web page.

Do you know how I can modify my code to assign the newly created Excel file the file name Contacts.XLS rather than Default.XLS?

My code is in the attached file:
ASP-CODE.txt
0
Comment
Question by:zimmer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39707615
1/ you are not writing a file, just output to the webbrowser that you tell it to interpret as an excel file

2/ Excel is smart/dumb enough to accept a textfile as input

3/ Default is the name of any new excel workbook i believe. When you press save.
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 2000 total points
ID: 39707884
Change

 Response.AddHeader("contenet-disposition", attachment);

Open in new window


to

 Response.AddHeader("content-disposition", attachment);

Open in new window

0
 

Author Closing Comment

by:zimmer9
ID: 39708418
Excellent catch!!!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question