We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,275 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Formatting Browse button

I have code (below) that opens a dialog box to either open or save a file. What I need to do though, is have the file location in the textbox next to it.

Can anyone tell me the code to do that?

protected void Browse_Click(object sender, EventArgs e)
        {
            string FileName = "ExporterOutput.txt";
            string FilePath = "C:/Users/oZ012D/My Documents/ExporterOutput.txt";
            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
            response.ClearContent();
            response.Clear();
            response.ContentType = "text/plain";
            response.AddHeader("Content-Disposition", "attachment; filename = " + FileName + ";");
            response.TransmitFile(FilePath);
            response.Write("This is a test line.");
            response.Flush();
            response.End();
}
2
Contributors
3
Replies
22 Hours
Discussion Span
1 Year Ago
Last Updated
4
Views
compulove
Junior Poster in Training
68 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Easy:

Private Sub opendialog_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles opendialog.FileOk
        filenamefield.Text = opendialog.FileName
    End Sub

opendialog = The file dialog
filenamefield = The textbox next to the button

butler1233
Newbie Poster
7 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Sorry I needed this in code-behind.

compulove
Junior Poster in Training
68 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

oh... can't help you there. Have fun.

butler1233
Newbie Poster
7 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0655 seconds using 2.68MB