簡體   English   中英

如何在新標簽頁中顯示動態生成的網頁?

[英]How to display a dynamically generated webpage to the new tab?

我已經在后面的代碼中動態生成了一個網頁。 如何在用戶桌面上加載並顯示它?(C#,asp.net)這是我的代碼:

       StringBuilder strHtm = new StringBuilder();


        strHtm.Append("<html>");
        strHtm.Append(Environment.NewLine);

        strHtm.Append("<head>");
        strHtm.Append(Environment.NewLine);
        strHtm.Append("<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">");
        strHtm.Append(Environment.NewLine);

       strHtm.Append("</head>");
        strHtm.Append(Environment.NewLine);

        strHtm.Append("<body>");
        strHtm.Append(Environment.NewLine);

         //some code here reading from datatable

        strHtm.Append("</body>");
        strHtm.Append(Environment.NewLine);

        strHtm.Append("</html>");
        strHtm.Append(Environment.NewLine);

現在如何在瀏覽器的新標簽頁或窗口中加載它?

  1. 添加另一個ASP頁面
  2. 將PlaceHolder添加到新創建的ASP頁面
  3. 刪除html,head,body標簽
  4. 最后在page_load中添加這一行代碼

     PlaceHolder1.Controls.Add(new LiteralControl(strHtm.ToString().Trim())) 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM