Skip to content

Save dialog box in asp.net c#

Ablafizi Kibiki

Ablafizi Kibiki

Asked Oct 8, 2013, 1:11 AM EDT1 answer
Share
LinkedInX
Hi there!, I can generate a pdf file in asp.net c# using iTextsharp,  but i want client to choose the location and file name instead of the default i provide for them
 here is my code

Document doc = new Document(iTextSharp.text.PageSize.A4);
            PdfWriter wr = PdfWriter.GetInstance(doc, new FileStream(@"C:\mypdf.pdf", FileMode.Create));
            doc.Open();
            int tt = Table1.Rows.Count;
            BtnTaskSave.Text = tt.ToString();
            PdfPTable table = new PdfPTable(2);
            for (int j = 0; j < tt; j++)
            {
                PdfPCell ce = new PdfPCell(new Phrase(Table1.Rows[j].Cells[0].Text));
                table.AddCell(ce);
                PdfPCell ce1 = new PdfPCell(new Phrase(Table1.Rows[j].Cells[1].Text));
                table.AddCell(ce1);
            }
            doc.Add(table);
            doc.Close();

thaks in advance.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Sunny  Sharma
    0
    Hi ablafizi ,

    It completely depends on the client machine configuration. If I've configured my machine to save all the files being downloaded to a default location, you can not check it from Server side or enforce user to choose a location. Your client need to change the settings for asking for permission each time a new file download is going to start.

    Hope you got the point.

    HTH :)
    0