hi,

i have a html file which contains placeholders.
i read the html file and replace the placeholders with object values of DB and
display it in lable control.

& now when i click the download i need save the contents of lable as html file . iwant to show save as dialog box. & object values are not getting replaced in placeholders of html file.

can any one suggest?

thanks,
sindhu

Recommended Answers

All 2 Replies

Did you transfer the contents of the labels into the file that is written?

If not, as you write the HTML file, use the HTML as a string and replace or insert your label data where it should go, then save the file.

The values from the lables are contained in the .Text property. Example:

label1.Text

System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
Response.ContentType = "application/html";
Response.AddHeader("Content-Disposition", "inline;filename=Test.html");
lblPayslip.RenderControl(hw);
Response.Write(sw.ToString());
Response.End();

i am trying to save the contents of lable lblPayslip to html file.
i need save as dialog box where i can select the location to save the file.

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.