📄 complexprofile.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ComplexProfile.aspx.cs" Inherits="ComplexProfile" %>
<%@ Import Namespace="System.Globalization" %>
<html xmlns="">
<head>
<title>Products</title>
</head>
<body>
<form id="form1" runat="server">
<table width="100%">
<tr>
<td valign="top">
<h2>
商品</h2>
<asp:GridView ID="ProductGrid" DataSourceID="ProductSource" DataKeyNames="ProductID"
AutoGenerateColumns="false" OnSelectedIndexChanged="AddCartItem" ShowHeader="false"
CellPadding="5" runat="Server">
<Columns>
<asp:ButtonField CommandName="select" Text="购买" />
<asp:BoundField DataField="ProductName" />
<asp:BoundField DataField="UnitPrice" DataFormatString="{0:c}" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="ProductSource" ConnectionString="Server=localhost;Database=Northwind;Trusted_Connection=true;"
SelectCommand="SELECT top 20 ProductID,ProductName,UnitPrice FROM Products" runat="Server" />
</td>
<td valign="top">
<h2>
购物篮</h2>
<asp:GridView ID="CartGrid" AutoGenerateColumns="false" DataKeyNames="ID" OnSelectedIndexChanged="RemoveCartItem"
CellPadding="5" Width="300" runat="Server">
<Columns>
<asp:ButtonField CommandName="select" Text="移除" />
<asp:BoundField DataField="Name" HeaderText="名称" />
<asp:BoundField DataField="Price" HeaderText="单价" DataFormatString="{0:c}" />
<asp:BoundField DataField="Quantity" HeaderText="数量" />
</Columns>
</asp:GridView>
总计<b>:</b>
<asp:Label ID="lblTotal" runat="Server" />
</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -