Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

In ASP.NET 4.0 using C#, how would you prevent READ-ONLY status when creating an Excel 2003 file by exporting records from GridView?

Posted on 2013-12-09
3
Medium Priority
?
824 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 an Excel 2003 file.

When I create the new Excel file, I notice that the title bar states that it is READ-ONLY.

Do you know how I can modify my following code to get rid of the READ-ONLY status on the Excel file?

My code is in the attachment:
----------------------------
ExcelExport.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
  • 2
3 Comments
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 39707878
As this file is considered "downloaded" for security reasons it is marked as read only. Try adding this site to trusted sites section in your browser( still I think it might not work and make the file read only)
0
 
LVL 8

Expert Comment

by:johny_bravo1
ID: 39707890
Try this,

var fInfo = new FileInfo(YourFilePathName );
fInfo.IsReadOnly = false;
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 2000 total points
ID: 39707898
I don't think the solution provided by johny_bravo1 will work here. No offense johny_bravo1. This read only message is different than standard read only file scenario. Also this file being generated on server side this method will not have any impact.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

618 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