<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="2" DataKeyNames="code" DataSourceID="SqlDataSource1" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" GridLines="Vertical" OnRowDeleting="GridView1_RowDeleting" Width="200px"> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> <RowStyle BackColor="#EEEEEE" ForeColor="Black" /> <Columns> <asp:TemplateField HeaderText="Item"> <ItemTemplate> <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("purl", "items/{0}") %>' /> </ItemTemplate> <ControlStyle Height="100px" Width="100px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Product Code" SortExpression="Product Code"> <ItemTemplate> <asp:Label ID="lblcode" runat="server" Text='<%# Bind("code") %>'/> </ItemTemplate> <ControlStyle Width="20px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Product Name" SortExpression="Product Name"> <ItemTemplate> <asp:Label ID="lblpname" runat="server" Text='<%# Bind("pname") %>'/> </ItemTemplate> <ControlStyle Width="120px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Price" SortExpression="Price"> <ItemTemplate> <asp:Label ID="lblprice" runat="server" Text='<%# Bind("price") %>'/> </ItemTemplate> <ControlStyle Width="100px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Quantity" SortExpression="Quantity"> <EditItemTemplate> <asp:TextBox ID="txtqty" runat="server" Text='<%# Bind("qty") %>'/> </EditItemTemplate> <ItemTemplate> <asp:Label ID="lblqty" runat="server" Text='<%# Bind("qty") %>'/> </ItemTemplate> <ControlStyle Width="20px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Total" SortExpression="Total"> <ItemTemplate> <asp:Label ID="lbltot" runat="server" Text='<%# Bind("tot") %>'/> </ItemTemplate> <ControlStyle Width="100px" /> </asp:TemplateField> <asp:CommandField ButtonType="Button" ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" HeaderText="Update" > <ControlStyle Width="50px" /> <ItemStyle Width="20px" /> </asp:CommandField> <asp:TemplateField HeaderText="check"> <EditItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </EditItemTemplate> <ItemTemplate> <asp:CheckBox ID="CheckBox1" runat="server" /> </ItemTemplate> <ControlStyle Width="10px" /> </asp:TemplateField> </Columns> <PagerStyle ForeColor="Black" HorizontalAlign="Center" BackColor="#999999" /> <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="Gainsboro" /> </asp:GridView> <br /><br /></center> <div align="right"> <asp:Label ForeColor="white" ID="lblt" Text="Total:" Font-Bold="True" Font-Size="X-Large" Width="108px" runat="server"/> <asp:Label CssClass="lbl1" ForeColor="White" ID="lbltot" Text="" runat="server" Font-Bold="True" Font-Size="X-Large" Width="108px"/> </div> <br /><br /><br /><br /> <asp:Button ID="final" runat="server" Text="Final Purchase" OnClick="final_Click" /> <br /> <br /> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT purl,code,pname,price,qty,(qty*price)as tot FROM [tmp]" UpdateCommand="UPDATE [tmp] set [qty] =@qty WHERE [code] = @code" DeleteCommand="delete tmp where code='@code'">
<UpdateParameters> <asp:Parameter Name="qty" Type="Int32" /> <asp:Parameter Name="code" Type="String" /> </UpdateParameters> <DeleteParameters> <asp:Parameter Name="code" Type="string" /> </DeleteParameters> </asp:SqlDataSource>
|