CustomerOrders.ascx
上传用户:mengyi0109
上传日期:2021-12-08
资源大小:58k
文件大小:2k
源码类别:

Ajax

开发平台:

Java

  1. <%@ Control Language="C#" ClassName="CustomerOrders" Inherits="CustomerOrders" %>
  2. <script runat="server">
  3.     protected override void OnLoad(EventArgs e)
  4.     {
  5.         this.sqlDsOrders.SelectParameters["CustomerID"].DefaultValue = this.CustomerId;
  6.         base.OnLoad(e);
  7.     }
  8. </script>
  9. <asp:SqlDataSource ID="sqlDsOrders" runat="server" ConnectionString="<%$ ConnectionStrings:Northwind %>"
  10.     SelectCommand="SELECT [OrderID], [OrderDate], [RequiredDate], [Freight], [ShippedDate] FROM [Orders] WHERE ([CustomerID] = @CustomerID)">
  11.     <SelectParameters>
  12.         <asp:Parameter Name="CustomerID" Type="String" DefaultValue="" />
  13.     </SelectParameters>
  14. </asp:SqlDataSource>
  15. <asp:Repeater ID="List" DataSourceID="sqlDsOrders" runat="server">
  16.     <HeaderTemplate>
  17.         <table class="grid" cellspacing="0" rules="all" border="1" style="border-collapse: collapse;">
  18.             <tr>
  19.                 <th scope="col">&nbsp;</th>
  20.                 <th scope="col">Order ID</th>
  21.                 <th scope="col">Date Ordered</th>
  22.                 <th scope="col">Date Required</th>
  23.                 <th scope="col" style="text-align: right;">Freight</th>
  24.                 <th scope="col">Date Shipped</th>
  25.             </tr>
  26.     </HeaderTemplate>
  27.     <ItemTemplate>
  28.         <tr class='<%# (Container.ItemIndex%2==0) ? "row" : "altrow" %>'>
  29.             <td class="rownum"><%# Container.ItemIndex+1 %></td>
  30.             <td style="width: 80px;"><%# Eval("OrderID") %></td>
  31.             <td style="width: 100px;"><%# Eval("OrderDate","{0:dd/MM/yyyy}") %></td>
  32.             <td style="width: 110px;"><%# Eval("RequiredDate", "{0:dd/MM/yyyy}")%></td>
  33.             <td style="width: 50px; text-align: right;"><%# Eval("Freight","{0:F2}") %></td>
  34.             <td style="width: 100px;"><%# Eval("ShippedDate", "{0:dd/MM/yyyy}")%></td>
  35.         </tr>
  36.     </ItemTemplate>
  37.     <FooterTemplate>
  38.         </table>
  39.     </FooterTemplate>
  40. </asp:Repeater>