0
好的,我寫了一個2表單應用程序。第一頁有一系列dropdownslist和一個gridview。客戶從下拉列表中選擇產品,它在GridView中顯示詳細信息。然後我有3個文本框,這樣用戶可以輸入他們想要的數量,他們的名字和地址。最下面是一個創建訂單按鈕,它現在重定向到下一頁。創建新客戶
但是,在該頁面上,我應該創建客戶並在屏幕上放置訂單,它應該說訂單已成功創建,訂單號和我應該使用稱爲CreateOrder的程序,爲此已提交給我。
但是,我需要知道我是否實際創建客戶並點擊第一頁上的按鈕進行訂購,然後讓訂單號顯示在第二頁上,或者我是否會在第二頁上創建客戶,並顯示訂單號碼?這裏是第1
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<div style="height: 182px">
Category: <asp:DropDownList ID="ddlCategory"
runat="server" DataSourceID="SqlDataSource1" DataTextField="CategoryName"
DataValueField="CategoryId" AutoPostBack="True"/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DeveloperInterviewConnectionString %>" SelectCommand="CategoryListing" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<br/>
Product: <asp:DropDownList ID="ddlProduct"
runat="server" DataSourceID="SqlDataSource2" DataTextField="ProductName"
DataValueField="ProductId" AutoPostBack="True"/>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStrings:DeveloperInterviewConnectionString %>" SelectCommand="CategoryProducts" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCategory" Name="CategoryId"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ProductId" DataSourceID="SqlDataSource3" Width="105px">
<Columns>
<asp:BoundField DataField="ProductId" HeaderText="ProductId" InsertVisible="False" ReadOnly="True" SortExpression="ProductId" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
<asp:BoundField DataField="ProductDescription" HeaderText="ProductDescription" SortExpression="ProductDescription" />
<asp:BoundField DataField="QuantityInStock" HeaderText="QuantityInStock" SortExpression="QuantityInStock" />
</Columns>
</asp:GridView>
<br/>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:DeveloperInterviewConnectionString %>" SelectCommand="SELECT [ProductId], [ProductName], [ProductDescription], [QuantityInStock] FROM [Product] WHERE ([ProductId] = @ProductId)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlProduct" Name="ProductId" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<p>
<asp:Label ID="Label1" runat="server" Text="Quantity to Order"></asp:Label>
<asp:TextBox ID="QuantityOrderTB" runat="server" Width="223px"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label2" runat="server" Text="Customer Name"></asp:Label>
<asp:TextBox ID="CustomerNameTB" runat="server" Width="223px"> </asp:TextBox>
</p>
<p>
<asp:Label ID="Label3" runat="server" Text="Customer Address"></asp:Label>
<asp:TextBox ID="CustomerAddressTB" runat="server" Height="61px" Width="260px"> </asp:TextBox>
</p>
<br />
<input type="button" value="Create Order"
onClick="location.href = 'Confirmation.aspx';">
</div>
</form>
</body>
</html>
我該怎麼做呢? –