📄 default.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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></title>
</head>
<body style="text-align: center">
<form id="form1" runat="server">
<table>
<tr>
<td style="width: 100px; text-align: center">
<asp:DataList ID="DataList1" runat="server" DataKeyField="tb_PID" DataSourceID="SqlDataSource1" e
Width="380px" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal" Height="1px" RepeatColumns="3" RepeatDirection="Horizontal" Font-Size="9pt">
<ItemTemplate>
<table>
<tr>
<td style="width: 40px; text-align: left">
编号:</td>
<td style="width: 116px; text-align: left">
<asp:Label ID="tb_PIDLabel" runat="server" Text='<%# Eval("tb_PID") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 40px; text-align: left">
姓名:</td>
<td style="width: 116px; text-align: left">
<asp:Label ID="tb_PNameLabel" runat="server" Text='<%# Eval("tb_PName") %>'></asp:Label></td>
</tr>
<tr>
<td style="width: 40px; text-align: left">
性别:</td>
<td style="width: 116px; text-align: left">
<asp:Label ID="tb_PSexLabel" runat="server" Text='<%# Eval("tb_PSex") %>'></asp:Label></td>
</tr>
</table>
</ItemTemplate>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<HeaderTemplate>
<strong><span style="font-size: 9pt">DataList控件</span></strong>
</HeaderTemplate>
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<SelectedItemTemplate>
</SelectedItemTemplate>
</asp:DataList>
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
DataKeyNames="tb_PID" DataSourceID="SqlDataSource1" Height="50px" Width="380px" EnablePagingCallbacks=true Font-Size="9pt">
<Fields>
<asp:BoundField DataField="tb_PID" HeaderText="tb_PID" ReadOnly="True" SortExpression="tb_PID" />
<asp:BoundField DataField="tb_PName" HeaderText="tb_PName" SortExpression="tb_PName" />
<asp:BoundField DataField="tb_PSex" HeaderText="tb_PSex" SortExpression="tb_PSex" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
</td>
</tr>
<tr>
<td style="width: 100px; height: 46px;">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DB_ADONETConnectionString %>"
DeleteCommand="DELETE FROM [t_People] WHERE [tb_PID] = @tb_PID" InsertCommand="INSERT INTO [t_People] ([tb_PID], [tb_PName], [tb_PSex]) VALUES (@tb_PID, @tb_PName, @tb_PSex)"
SelectCommand="SELECT * FROM [t_People]" UpdateCommand="UPDATE [t_People] SET [tb_PName] = @tb_PName, [tb_PSex] = @tb_PSex WHERE [tb_PID] = @tb_PID">
<DeleteParameters>
<asp:Parameter Name="tb_PID" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="tb_PName" Type="String" />
<asp:Parameter Name="tb_PSex" Type="String" />
<asp:Parameter Name="tb_PID" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="tb_PID" Type="String" />
<asp:Parameter Name="tb_PName" Type="String" />
<asp:Parameter Name="tb_PSex" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -