零代码,即没有后端代码, 所有东西均通过设计视图拖放完成,下面就是一个使用设计视图完成的留言簿
数据库表 GuestBook:
ID int PK,自增
Name varchar(50)
Email varchar(50)
Message varchar(50)
PostDate datetime getdate()
通过设计器产生的代码 lishewen.aspx:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="lishewen.aspx.vb" Inherits="Myweb_lishewen" %>
<!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>Untitled Page</title>
<script type="text/javascript">
function pageLoad() {
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<h1>
Message List</h1>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="messageList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name"></asp:BoundField>
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email"></asp:BoundField>
<asp:BoundField DataField="Message" HeaderText="Message" SortExpression="Message&quo |