繁体   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