p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 28th, 2009, 06:26 AM
Authorized User
Points: 125, Level: 2
Points: 125, Level: 2 Points: 125, Level: 2 Points: 125, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2008
Location: Cape Town, Western Cape, South Africa.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Refreshing Solution Explorer

hi everyone, does anyone have an idea on how to programmatically refresh the solution explorer in asp.net/c# or vb.net, i am exporting a gridview to an txt file and upload it, after that i've added the lines of code that will force the file to be downloaded to the client machine, so after uploading it can't locate and open the file because the solution explorer needs to be refreshed manually. here's my code:

DBConnection cd = new DBConnection();
DataSet ds = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter("select requesitionid,department,vendorName from tblRequisition", cd.con);
adp.Fill(ds);
// Create the CSV file to which grid data will be exported.
string path = Server.MapPath("~/Payment.txt");
StreamWriter sw = new StreamWriter(path);
// First we will write the headers.
DataTable dt = ds.Tables[0];
int iColCount = dt.Columns.Count;
for (int i = 0; i < iColCount; i++)
{
sw.Write(dt.Columns[i]);
if (i < iColCount - 1)
{
sw.Write(",");
}
}
sw.Write(sw.NewLine);
// Now write all the rows.
foreach (DataRow dr in dt.Rows)
{
for (int i = 0; i < iColCount; i++)
{
if (!Convert.IsDBNull(dr[i]))
{
sw.Write(dr[i].ToString());
}
if (i < iColCount - 1)
{
sw.Write(",");
}
}
sw.Write(sw.NewLine);
}
sw.Close();

//the downloading part starts here

System.IO.FileStream fs = null;
fs = System.IO.File.Open(Server.MapPath(path), System.IO.FileMode.Open);
byte[] btFile = new byte[fs.Length];
fs.Read(btFile, 0, Convert.ToInt32(fs.Length));
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=" + path);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(btFile);
Response.End();

Thanks in advance.
__________________
supertedz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old November 2nd, 2009, 10:59 AM
Friend of Wrox
Points: 512, Level: 8
Points: 512, Level: 8 Points: 512, Level: 8 Points: 512, Level: 8
Activity: 5%
Activity: 5% Activity: 5% Activity: 5%
 
Join Date: Feb 2006
Location: noida, UP, India.
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

hi..
First of all, I would like to tell you that Solution Explorer is only used to create your project, nothing else and your file is getting saved on the physical drive and it will be read from that path (not solution explorer). It is actually IIS that runs your website.

What is the exact error you are getting?
__________________
Gaurav
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Solution Explorer does not show designer.vb file dotnetDeveloper ASP.NET 3.5 Basics 1 December 29th, 2008 11:59 AM
Ch 14 References in Solution Explorer w/ VS 2005? cJeffreywang BOOK: Beginning VB.NET Databases 1 July 28th, 2008 02:09 PM
page not refreshing Bill Crawley ASP.NET 2.0 Basics 8 February 28th, 2007 11:39 AM
Solution explorer and server explorer adelp2p BOOK: ASP.NET 2.0 Beta Preview 0 March 1st, 2005 07:18 AM
refreshing XML withour refreshing the page sasidhar79 XML 1 January 12th, 2005 05:16 AM



All times are GMT -4. The time now is 11:46 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc