CustomerOrders.ascx
上传用户:mengyi0109
上传日期:2021-12-08
资源大小:58k
文件大小:2k
- <%@ Control Language="C#" ClassName="CustomerOrders" Inherits="CustomerOrders" %>
- <script runat="server">
- protected override void OnLoad(EventArgs e)
- {
- this.sqlDsOrders.SelectParameters["CustomerID"].DefaultValue = this.CustomerId;
- base.OnLoad(e);
- }
- </script>
- <asp:SqlDataSource ID="sqlDsOrders" runat="server" ConnectionString="<%$ ConnectionStrings:Northwind %>"
- SelectCommand="SELECT [OrderID], [OrderDate], [RequiredDate], [Freight], [ShippedDate] FROM [Orders] WHERE ([CustomerID] = @CustomerID)">
- <SelectParameters>
- <asp:Parameter Name="CustomerID" Type="String" DefaultValue="" />
- </SelectParameters>
- </asp:SqlDataSource>
- <asp:Repeater ID="List" DataSourceID="sqlDsOrders" runat="server">
- <HeaderTemplate>
- <table class="grid" cellspacing="0" rules="all" border="1" style="border-collapse: collapse;">
- <tr>
- <th scope="col"> </th>
- <th scope="col">Order ID</th>
- <th scope="col">Date Ordered</th>
- <th scope="col">Date Required</th>
- <th scope="col" style="text-align: right;">Freight</th>
- <th scope="col">Date Shipped</th>
- </tr>
- </HeaderTemplate>
- <ItemTemplate>
- <tr class='<%# (Container.ItemIndex%2==0) ? "row" : "altrow" %>'>
- <td class="rownum"><%# Container.ItemIndex+1 %></td>
- <td style="width: 80px;"><%# Eval("OrderID") %></td>
- <td style="width: 100px;"><%# Eval("OrderDate","{0:dd/MM/yyyy}") %></td>
- <td style="width: 110px;"><%# Eval("RequiredDate", "{0:dd/MM/yyyy}")%></td>
- <td style="width: 50px; text-align: right;"><%# Eval("Freight","{0:F2}") %></td>
- <td style="width: 100px;"><%# Eval("ShippedDate", "{0:dd/MM/yyyy}")%></td>
- </tr>
- </ItemTemplate>
- <FooterTemplate>
- </table>
- </FooterTemplate>
- </asp:Repeater>