📄 shop.aspx
字号:
<%@ Import Namespace="System.Data" %>
<html>
<head>
<title>Web Service Demo</title>
<script language="C#" runat="server" >
void Page_Load()
{
if(!IsPostBack)
{
Shop shop = new Shop();
DataSet dataSet = shop.GetList();
grid1.DataSource = dataSet;
grid1.DataBind();
}
}
void Grid_ItemCommand(object sender, DataGridCommandEventArgs arg)
{
DataGridItem item = arg.Item;
Shop shop = new Shop();
string id = item.Cells[2].Text;
int count = int.Parse( ((TextBox)item.Cells[0].FindControl("txtCount")).Text );
shop.OrderGood( id, count);
Label1.Text += "<br/>" + item.Cells[3].Text + "-" + count.ToString();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>网上商店 Web Service Demo</h3>
<asp:DataGrid id="grid1" runat="server" OnItemCommand="Grid_ItemCommand">
<Columns>
<asp:ButtonColumn HeaderText="命令" Text="定购" ButtonType="PushButton" />
<asp:TemplateColumn HeaderText="数量">
<ItemTemplate>
<asp:TextBox id="txtCount" width="30pt" runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<hr/><asp:Label id="Label1" runat="server">已经定购</asp:Label>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -