📄 default.aspx
字号:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="system.configuration" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlDataAdapter("select * from gbdb order by id DESC", myConnection)
Dim ds As New DataSet()
myCommand.Fill(ds, "gbdb")
dim pp as New PagedDataSource()
pp.DataSource=ds.Tables("gbdb").DefaultView
pp.AllowPaging=true
pp.PageSize=5
dim cpage as Integer
if Request.QueryString("Page")<>"" then
cpage=Convert.ToInt32(Request.QueryString("Page"))
else
cpage=1
end if
pp.CurrentPageIndex=cpage-1
if not pp.IsFirstPage then
pre.NavigateUrl=Request.CurrentExecutionFilePath + "?page=" + Convert.ToString(cpage-1)
end if
if not pp.IsLastPage then
nextpage.NavigateUrl=Request.CurrentExecutionFilePath+ "?page=" + Convert.ToString(cpage+1)
end if
MyDataList.DataSource=pp
MyDataList.DataBind()
End Sub
</script>
<html>
<head>
<title>非非.net留言本</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
<style type="text/css">
.topic {
COLOR: #ffffff
}
body {
margin-left: 0px;
margin-top: 0px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<!-- #include virtual="./top.inc" -->
<form runat="server"><table width="700" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td height="30"><p><a href="add.aspx"><img src="images/add.gif" width="80" height="25" border="0"></a> <%If IsNothing(request.cookies("chkadmin")) Then%><a href="login.aspx"><img src="images/login.gif" width="80" height="25" border="0"></a><%else%><a href="pass.aspx"><img src="images/pass.gif" width="80" height="25" border="0"></a> <a href="logout.aspx"><img src="images/logout.gif" width="80" height="25" border="0"></a><%end if%></p></td>
</tr>
</table>
<ASP:DataList id="MyDataList" RepeatColumns="1" RepeatLayout="Flow" runat="server">
<ItemTemplate>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#000000">
<tr bgcolor="#000000">
<td width="150" height="22"></td>
<td width="550" height="22">
<span class="topic">留言主题:<%# DataBinder.Eval(Container.DataItem, "topic") %></span></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="120"><table width="95%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td colspan="2"><div align="center"><img src="pic/<%# DataBinder.Eval(Container.DataItem, "pic") %>"></div></td>
</tr>
<tr>
<td width="35%" height="22"><div align="right">昵称:</div></td>
<td width="65%"><%# DataBinder.Eval(Container.DataItem,"username") %></td>
</tr>
<tr>
<td height="22"><div align="right">QQ号码:</div></td>
<td height="22"><%# DataBinder.Eval(Container.DataItem,"qq") %></td>
</tr>
<tr>
<td height="22"><div align="right">Email:</div></td>
<td height="22"><%# DataBinder.Eval(Container.DataItem,"email") %></td>
</tr>
</table></td>
<td height="120" style="word-break:break-all"><%# DataBinder.Eval(Container.DataItem, "content") %></td>
</tr bgcolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td height="25" colspan="2">
<div align="right">发表日期:<%# DataBinder.Eval(Container.DataItem, "riqi") %>
</div>
</td>
</tr>
<%If IsNothing(request.cookies("chkadmin")) Then%>
</table>
<%else%>
<tr bgcolor="#FFFFFF">
<td height="25" colspan="2">
<div align="left">管理选项: <a href='<%# DataBinder.Eval(Container.DataItem, "id", "del.aspx?id={0}") %>' >删除</a></div></td>
</tr>
</table>
<%end if%>
</ItemTemplate>
</ASP:DataList>
</p>
<p>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#000000">
<tbody>
<tr>
<td height="30" bgcolor="#FFFFFF"><p align="right"><asp:hyperlink id="pre" runat="server">上一页</asp:hyperlink> <asp:hyperlink id="nextpage" runat="server">下一页</asp:hyperlink>
</p></td>
</tr>
</tbody>
</table>
<!-- #include virtual="./boot.inc" -->
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -