[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3564
  • Last Modified:

How to write HTML out to aspx page from C#

I'm trying to write some HTML out to the screen stored in a variable, I don't want to write the literal value I want to generate the page based on the HTML.  PageData is the variable that contains the HTML.  How would I write this out to the ASPX page and generate the HTML?  Thanks for any help.




public partial class PrintPreview : CommonPage
{
   public PrintPreview()
   {
        string Debug = "";
        string PageData = "";
        string htmlCode = Request.QueryString.Get("HTML");
     
        try
        {

            string[] results = BAL.processReprints(htmlCode);
            PageData = results[0].ToString();
           
        }
        catch (Exception ex)
        {
            Logging.LogEntry(ex.Message);
           
        }
    }
}

0
jayv21
Asked:
jayv21
1 Solution
 
Expert1701Commented:
You can write raw HTML out to your ASPX page by using Response.Write.
0
 
hamidovtCommented:
If you are on the webpage you could use:
Page.Response.Write("my text");
or
Page.Controls.Add(new System.Web.UI.LiteralControl("my text"));

If you do not have access to page object (programming within a class), you could use:

System.Web.HttpContext.Current.Response.Write ("my text");
0
 
jayv21Author Commented:
Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now