如题

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>${CBM:PUBLIC.TFormTitle}</title>
    <link href="/css/default/Templatecss.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .STYLE1 { font-size: 14pt;
    font-weight: bold;
    }
    .STYLE2 { font-size: 24pt;
    font-weight: bold;
    }
    .STYLE4 {font-size: 12px; font-weight: bold; }
    -->
    </style>
    </head>
    <body>
    <form action="" name="Frm_TFormView" method="post">
      <table width="640px" height="95%" border="0" align="center" cellpadding="1" cellspacing="0" bordercolor="#000000">
        <tr>
          <td height="400" bgcolor="#C2D4DA"><table width="98%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#FFFFFF" class="tform">
              <tr>
                <th width="140" align="left" class="STYLE1">申报工程名称:</th>
                <td colspan="2" align="left" class="AlignLeftInput">${CBM:View.Row_4660}</td>
              </tr>
              <tr>
                <th align="left" class="STYLE1">申 报 单 位:</th>
                <td width="431" align="left" class="AlignLeftInput">${CBM:View.Row_4661}</td>
                <td width="40" align="left" class="AlignLeftInput"><span class="STYLE4">(公章)</span></td>
              </tr>
              <tr>
                <th align="left" class="STYLE1">申 报 日 期:</th>
                <td colspan="2" class="textcenter">${CBM:View.Row_4662}</td>
              </tr>
          </table></td>
        </tr>
      </table>
    </body>
    </html>
    这是html文件
      

  2.   

    读取该文件 然后按照你的需要替换${CBM:View.Row_4662}这类
      

  3.   

    回复 peterb 现在关键问题是 替换后的字符串怎么呈现给用看到 字符串中有css等
      

  4.   


    引用
    using System.IO;        string str="";
            Response.Charset = "gb2312";
            Page.EnableViewState = false;
            System.IO.StringWriter tw = new System.IO.StringWriter();
            HtmlTextWriter wt = new HtmlTextWriter(tw);
            //读取生成页面的代码
             Server.Execute("../template.aspx", tw);
            //把源码赋给字符串,接下来就是你要用Replace来处理了
            str= tw.ToString();
            tw.Close();
      
      

  5.   

    你是指生成静态页,还是把html代码动态的写入asp.net中呢?
      

  6.   

    HttpWebRequest我试了  是要生成一个对应文件 我现在不想生成这个文件 
      

  7.   

    把html代码动态的写入asp.net中
      

  8.   

    回复 aiyumen 你的方法可以把html文件读出来了 可是怎么显示给用户看到了 不生成新的页面
      

  9.   

    呵呵,这个嘛,用httpHandels,
    你看看这个你就明白了
    http://webuc.net/dotey/archive/2004/06/08/966.aspx
      

  10.   

    你动态显示在页面中,取得请求文件流后在Response.write不就可以了吗? this.GridView1.DataSource = CreateTable();
            this.GridView1.DataBind();
            //this.Request.Url.ToString().Replace("Default.aspx","") + "Default2.aspx"
            System.Net.WebRequest request = System.Net.WebRequest.Create("http://www.csdn.net/");
            System.Net.WebResponse response = request.GetResponse();
            Response.Write(new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd());