📄 viewcart.aspx
字号:
<%@ Page Language="VB" MasterPageFile="~/user.master" Title="Untitled Page" %>
<script runat="server">
Protected Sub btpurchase_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim item1 As Integer
item1 = itemlist.Rows.Count.ToString
Session("items") = item1
If (TextBox1.Text = "") Then
MsgBox("Please calculate total price", MsgBoxStyle.Information, "Calculate Price")
End If
Response.Redirect("purchase.aspx")
'MsgBox("no of rows " + (itemlist.Rows.Count.ToString))
End Sub
Protected Sub calprice_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim item1, i As Integer
i = 0
Dim sum As Double
item1 = itemlist.Rows.Count.ToString
While i < item1
sum = sum + CInt(itemlist.Rows(i).Cells(4).Text)
i = i + 1
End While
Session("totalprice") = sum
TextBox1.Text = sum
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 466px">
<tr>
<td colspan="3" style="background-image: url(images/footer_bg.gif); height: 32px; text-align: center;">
<span style="font-size: 16pt; color: #ffffff">Y O U R C H O O S E N
P R O D U C T S</span></td>
</tr>
<tr>
<td colspan="3" rowspan="2" style="text-align: left">
<asp:GridView ID="itemlist" runat="server" DataSourceID="SqlDataSource1" Width="852px" AllowPaging="True">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>" DeleteCommand="DELETE FROM [tbaddcart] WHERE [CartId] = @original_CartId AND [CustomerId] = @original_CustomerId AND [ProductName] = @original_ProductName AND [ProductPrice] = @original_ProductPrice AND [Author] = @original_Author AND [Type] = @original_Type AND [Status] = @original_Status"
InsertCommand="INSERT INTO [tbaddcart] ([CustomerId], [ProductName], [ProductPrice], [Author], [Type], [Status]) VALUES (@CustomerId, @ProductName, @ProductPrice, @Author, @Type, @Status)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [tbaddcart] WHERE (([CustomerId] = @CustomerId) AND ([Status] = @Status))"
UpdateCommand="UPDATE [tbaddcart] SET [CustomerId] = @CustomerId, [ProductName] = @ProductName, [ProductPrice] = @ProductPrice, [Author] = @Author, [Type] = @Type, [Status] = @Status WHERE [CartId] = @original_CartId AND [CustomerId] = @original_CustomerId AND [ProductName] = @original_ProductName AND [ProductPrice] = @original_ProductPrice AND [Author] = @original_Author AND [Type] = @original_Type AND [Status] = @original_Status">
<DeleteParameters>
<asp:Parameter Name="original_CartId" Type="Int64" />
<asp:Parameter Name="original_CustomerId" Type="String" />
<asp:Parameter Name="original_ProductName" Type="String" />
<asp:Parameter Name="original_ProductPrice" Type="String" />
<asp:Parameter Name="original_Author" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
<asp:Parameter Name="original_Status" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CustomerId" Type="String" />
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="ProductPrice" Type="String" />
<asp:Parameter Name="Author" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Status" Type="String" />
<asp:Parameter Name="original_CartId" Type="Int64" />
<asp:Parameter Name="original_CustomerId" Type="String" />
<asp:Parameter Name="original_ProductName" Type="String" />
<asp:Parameter Name="original_ProductPrice" Type="String" />
<asp:Parameter Name="original_Author" Type="String" />
<asp:Parameter Name="original_Type" Type="String" />
<asp:Parameter Name="original_Status" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="CustomerId" Type="String" />
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="ProductPrice" Type="String" />
<asp:Parameter Name="Author" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="Status" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:SessionParameter Name="CustomerId" SessionField="username" Type="String" />
<asp:Parameter DefaultValue="Not Purchased" Name="Status" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan="3" rowspan="1" style="text-align: center">
<asp:Button ID="calprice" runat="server" OnClick="calprice_Click" Text="Calculate Price" />
<asp:Button ID="btpurchase" runat="server" OnClick="btpurchase_Click" Text="Purchase" />
</td>
</tr>
<tr>
<td colspan="3" rowspan="1" style="text-align: center">
<asp:TextBox ID="TextBox1" runat="server" Enabled="False" Width="92px"></asp:TextBox>(
In Rupees)</td>
</tr>
</table>
</asp:Content>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -