Asp. NET generation of static page technology

Source: Internet
Author: User
Tags comments datetime stack trace connectionstrings

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>
&LT;TD style= "width:30px; Color: #fff ">ID</td>
&LT;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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.