Template page
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Enterprise Hall-ASP. NET generates static page technology </title>
<style type= "Text/css" >
Body{background: #62A6CD; color: #fff; font-size:14px; font-family:verdana; line-height:20px;}
h1{line-height:35px;}
td{padding-left:5px;}
</style>
<body>
<table cellpadding= "0" cellspacing= "1" style= "width:200px; Background: #666; Color: #333; ">
<tr>
<TD style= "width:30px; Color: #fff ">ID</td>
<TD style= "width:170px; Color: #fff ">Name</td>
</tr>
<!--Repeat{select * from test}-->
<tr style= "LINE-HEIGHT:26PX; Background: #fff; " >
<td>{Id}</td>
<td><a href= "staticdetail_{id}.htm" target= "_blank" >{Name}</a></td>
</tr>
<!--repeatend-->
</table>
</body>
Web.config file
<?xml version= "1.0" encoding= "Utf-8"?>
<!--
Note: In addition to manually editing this file, you can also use the
WEB Administration Tool to configure settings for your application. Can be used in Visual Studio
The Web site-> the asp.net configuration option.
The complete list of settings and comments is
Machine.config.comments, this file is typically located in the
In WindowsMicrosoft.NetFrameworkv2.xConfig
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name= "qytangconnectionstring" connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=| datadirectory| Test.mdb "providername=" System.Data.OleDb "/>
</connectionStrings>
<system.web>
<!--
Set compilation debug= "True" to insert debug symbols
Pages that have been compiled. But since this will
Affect performance, so this value is only in the development process
Set to True.
-->
<compilation debug= "false"/>
<!--
The <authentication> section allows you to configure the asp.net used by
Secure authentication Mode,
To identify the incoming user.
-->
<authentication mode= "Windows"/>
<!--
If an unhandled error occurs during the execution of the request,
The <customErrors> section allows you to configure the appropriate processing steps. Specifically
The section enables developers to configure
HTML error page to display
In place of the error stack trace.
<customerrors mode= "RemoteOnly" defaultredirect= "genericerrorpage.htm" >
<error statuscode= "403" redirect= "noaccess.htm"/>
<error statuscode= "404" redirect= "filenotfound.htm"/>
</customErrors>
-->
</system.web>
</configuration>
Index.aspx.cs file
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
Using Qytang.gengerate;
public partial class Index:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
if (! Page.IsPostBack)
{
}
}
protected void btnSubmit_Click (object sender, EventArgs e)
{
Try
{
DateTime dt = DateTime.Now;
Gengerate g = new Gengerate ();
G.gengeratehtml ();
DateTime DT2 = DateTime.Now;
TimeSpan ts = dt2. Subtract (DT);
String strts = ts. Totalseconds.tostring ();
Ltgengerate.text = "Build success, generate when" + Strts + "seconds!" ";
}
catch (Exception ex)
{
Throw ex;
}
}
}
index.aspx file
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "Index"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>-ASP. NET generates static page technology </title>
<style type= "Text/css" >
Body{background: #62A6CD; color: #fff; font-size:14px; font-family:verdana; line-height:20px;}
input{line-height:20px;}
</style>
<body>
<form id= "Form1" runat= "Server" >
Friendly reminder: Before opening the static homepage, please make a static page. <br/><br/>
<input id= "btnstatic" type= button "value=" Open static Main Table page "/> <asp:button id=" btnsubmit "runat=" server "text=" Generate static Page " onclick= "btnSubmit_Click"/> <asp:literal id= "ltgengerate" runat= "Server" ></asp:Literal>
</form>
<script type= "Text/javascript" >
var Btnstatic=document.getelementbyid ("Btnstatic");
Btnstatic.onclick=function () {window.open ("staticmain.htm")}
</script>
</body>