<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="DXWebApplication1.Test" %> <%@ Register Assembly="DevExpress.Web.v14.1, Version=14.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %> <%@ Register Assembly="DevExpress.Web.v14.1, Version=14.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="Scripts/jquery-1.8.2.js"></script> <script src="Scripts/jquery-1.4.1.min.js"></script> <script type="text/javascript"> $(function () { $("#ASPxGridView1").find("input[title='item_quantity']").blur(function () { var item_quantity = $(this).val(); var item_price = $("#ASPxGridView1").find("input[title='item_price']").val(); if (item_quantity != "" && item_price != "") { var total = parseInt(item_price) + parseInt(item_quantity); $("#ASPxGridView1").find("input[title='item_amount']").val(total); } else { $("#ASPxGridView1").find("input[title='item_amount']").val(""); } }) }) </script> <script type="text/javascript"> function DoProcessEnterKey(htmlEvent, editName) { if (htmlEvent.keyCode == 13 && editName == "textbox1") { ASPxClientUtils.PreventEventAndBubble(htmlEvent); btn.DoClick(); } if (htmlEvent.keyCode == 13 && editName == "textbox4") { ASPxClientUtils.PreventEventAndBubble(htmlEvent); btn_price.DoClick(); } } </script> </head> <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" EnableTheming="True" KeyFieldName="transaction_id" OnRowCommand="ASPxGridView1_RowCommand" OnRowUpdated="ASPxGridView1_RowUpdated" OnRowUpdating="ASPxGridView1_RowUpdating" Theme="Metropolis"> <Columns> <dx:GridViewCommandColumn ShowDeleteButton="True" ShowEditButton="True" VisibleIndex="0"> </dx:GridViewCommandColumn> <dx:GridViewDataTextColumn FieldName="item_number" VisibleIndex="1"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="item_description" VisibleIndex="2"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="item_unit" VisibleIndex="3"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="item_quantity" VisibleIndex="4"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="item_price" VisibleIndex="5"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="item_amount" VisibleIndex="6"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn FieldName="voucher_number" VisibleIndex="7"> </dx:GridViewDataTextColumn> </Columns> <SettingsBehavior ConfirmDelete="True" /> <SettingsEditing Mode="PopupEditForm"> </SettingsEditing> <Settings ShowFilterRow="True" ShowFooter="True" /> </dx:ASPxGridView> </ContentTemplate> </asp:UpdatePanel> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:item_detailConnectionString %>" DeleteCommand="DELETE FROM [tbl_item_detail_transactions] WHERE [transaction_id] = @transaction_id" InsertCommand="INSERT INTO [tbl_item_detail_transactions] ([item_number], [item_description], [item_unit], [item_quantity], [item_price], [item_amount], [voucher_number]) VALUES (@item_number, @item_description, @item_unit, @item_quantity, @item_price, @item_amount, @voucher_number)" SelectCommand="SELECT *, (item_quantity * item_price) as item_amount2 FROM [tbl_item_detail_transactions]" UpdateCommand="UPDATE [tbl_item_detail_transactions] SET [item_number] = @item_number, [item_description] = @item_description, [item_unit] = @item_unit, [item_quantity] = @item_quantity, [item_price] = @item_price, [item_amount] = @item_amount, [voucher_number] = @voucher_number WHERE [transaction_id] = @transaction_id"> <DeleteParameters> <asp:Parameter Name="transaction_id" Type="Int32" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="item_number" Type="Int32" /> <asp:Parameter Name="item_description" Type="String" /> <asp:Parameter Name="item_unit" Type="Int32" /> <asp:Parameter Name="item_quantity" Type="Int32" /> <asp:Parameter Name="item_price" Type="Int32" /> <asp:Parameter Name="item_amount2" Type="Int32" /> <asp:Parameter Name="voucher_number" Type="Int32" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="item_number" Type="Int32" /> <asp:Parameter Name="item_description" Type="String" /> <asp:Parameter Name="item_unit" Type="Int32" /> <asp:Parameter Name="item_quantity" Type="Int32" /> <asp:Parameter Name="item_price" Type="Int32" /> <asp:Parameter Name="item_amount" Type="Int32" /> <asp:Parameter Name="voucher_number" Type="Int32" /> <asp:Parameter Name="transaction_id" Type="Int32" /> </UpdateParameters> </asp:SqlDataSource>