扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
|
void orderGridView_PageIndexChanged(object sender, EventArgs e) { orderGridView.SelectedIndex = -1; } |
<form id="form1" runat="server"> <div style="width:50%;float:left;padding-right:10px;"> <h2>Select an Order from the Left...</h2> <asp:SqlDataSource ID="ordersDataSource" Runat="server" SelectCommand="SELECT dbo.Orders.OrderID, dbo.Customers.CompanyName, dbo.Orders.OrderDate FROM dbo.Orders INNER JOIN dbo.Customers ON dbo.Orders.CustomerID = dbo.Customers.CustomerID" ConnectionString= "<%$ ConnectionStrings:NWConnectionString %>"> </asp:SqlDataSource> <asp:GridView ID="orderGridView" Runat="server" DataSourceID="ordersDataSource" DataKeyNames="OrderID" AutoGenerateColumns="False" AllowPaging="True" BorderWidth="1px" BackColor="#DEBA84" CellPadding="3" CellSpacing="2" BorderStyle="None" BorderColor="#DEBA84" OnPageIndexChanged="orderGridView_PageIndexChanged"> <FooterStyle ForeColor="#8C4510" BackColor="#F7DFB5"></FooterStyle> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center"></PagerStyle> <HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#A55129"></HeaderStyle> <Columns> <asp:CommandField ShowSelectButton="True" SelectText="View Order Details"></asp:CommandField> <asp:BoundField HeaderText="Company" DataField="CompanyName" SortExpression="CompanyName"></asp:BoundField> <asp:BoundField HeaderText="Order Date" DataField="OrderDate" SortExpression="OrderDate" DataFormatString="{0:d}"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> </Columns> <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#738A9C"></SelectedRowStyle> <RowStyle ForeColor="#8C4510" BackColor="#FFF7E7"></RowStyle> </asp:GridView> </div> <div> <h2>... and View the Order Details on the Right</h2> <asp:SqlDataSource ID="orderDetailsDataSource" Runat="server" SelectCommand="SELECT dbo.[Order Details].OrderID, dbo.Products.ProductName, dbo.[Order Details].UnitPrice, dbo.[Order Details].Quantity, dbo.[Order Details].Discount FROM dbo.[Order Details] INNER JOIN dbo.Products ON dbo.[Order Details].ProductID = dbo.Products.ProductID WHERE dbo.[Order Details].OrderID = @OrderID" ConnectionString="<%$ ConnectionStrings:NWConnectionString %>"> <SelectParameters> <asp:ControlParameter ControlID="orderGridView" Name="OrderID" Type="Int32" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> <asp:GridView ID="detailsGridView" Runat="server" DataSourceID="orderDetailsDataSource" AutoGenerateColumns="False" BorderWidth="1px" BackColor="#DEBA84" CellPadding="3" CellSpacing="2" BorderStyle="None" BorderColor="#DEBA84"> <FooterStyle ForeColor="#8C4510" BackColor="#F7DFB5"></FooterStyle> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center"></PagerStyle> <HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#A55129"></HeaderStyle> <Columns> <asp:BoundField HeaderText="Product" DataField="ProductName" SortExpression="ProductName"></asp:BoundField> <asp:BoundField HeaderText="Unit Price" DataField="UnitPrice" SortExpression="UnitPrice" DataFormatString="{0:c}"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> <asp:BoundField HeaderText="Quantity" DataField="Quantity" SortExpression="Quantity"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> <asp:BoundField HeaderText="Discount" DataField="Discount" SortExpression="Discount" DataFormatString="{0:P}"> <ItemStyle HorizontalAlign="Right"></ItemStyle> </asp:BoundField> </Columns> <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#738A9C"></SelectedRowStyle> <RowStyle ForeColor="#8C4510" BackColor="#FFF7E7"></RowStyle> </asp:GridView> </div> </form> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者