Template page
<! 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> enterprise Hall-ASP. NET static page generation 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>
</Head>
<Body>
<H1> static master table page <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>
</Html>
Web. config file
<? Xml version = "1.0" encoding = "UTF-8"?>
<! --
Note: In addition to manually editing this file, you can also use
Web management tools to configure application settings. You can use
"Website"-> "Asp. Net configuration" option.
The complete list of settings and comments is displayed in
In machine. config. comments, this file is usually located in
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 the debugging symbol
Compiled pages. However, this
Performance is affected, so this value is only available during development.
Set to true.
-->
<Compilation debug = "false"/>
<! --
In the <authentication> section, you can configure
Security Authentication mode,
To identify the user.
-->
<Authentication mode = "Windows"/>
<! --
If an unprocessed error occurs during request execution,
You can configure the corresponding processing steps in the <mermerrors> section. Specifically,
This section allows developers to configure
Html error page to be displayed
To replace 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 = "generated successfully, generated in seconds" + strTs +! ";
}
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">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title>-ASP. NET static page generation 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>
</Head>
<Body>
<Form id = "form1" runat = "server">
Reminder: before you open the static homepage, please turn it into a static page. <Br/>
<Input id = "btnStatic" type = "button" value = "Open static master 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>
</Html>