hi

i am using visual studio 2008 and i want to save a text file in local path so can anyone explain how to open save dialog box in ASP.NET while i click button .please send with example coding


thanks
regards
suresh.S

Recommended Answers

All 3 Replies

What i think you need a download link insted of save dialog box..Because Server never save any thing to client machine directly.
I can be in Window form not in Asp.net...
If you want to save a file on server there is a control named file up-loader..
if i am not wrong..
OR please give full brief of your requirement..
Shakeb Khan

hi
now i am explaining my situation .once i submit the button i need to write all the records from gridview to text file .After this textfile need to save depends on user selected path can u tell how can i do ..

thanks

I am still not clear but it look like you want to store txt file on User System.i think.
if no then this is the code will help you to store file on Server

tring DirctoryPath = Server.MapPath(FolderName);
                    DirectoryInfo dirinfo = new DirectoryInfo(DirctoryPath);
                    if (!Directory.Exists(DirctoryPath))
                        dirinfo.Create();
                    else
                    {
                        FileInfo TheFile = new FileInfo(DirctoryPath + "\\" + Filename);
                        if (TheFile.Exists)
                            File.Delete(DirctoryPath + "\\" +FileName);
                    } 

 FileUploader.SaveAs(DirctoryPath + "\\" + FileName);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.