2014-02-23 75 views
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> 

回答

0

你可以改变你的按钮,服务器端的按钮

然后服务器端事件添加到它的代码。

+0

我该怎么做呢? –