在aspx页面中从Javascript调用数据库

时间:2017-11-28 21:27:55

标签: javascript asp.net devexpress aspxgridview

我使用了在页面加载时填充的devexpress工具的gridview。当我选择一行时,我有一个按钮,允许我通过弹出一个允许我更改信息的编辑框来编辑该行中的信息。我遇到的问题是,当他们单击该按钮时,gridivew后面的数据可能已更改,因此我希望能够在单击该编辑按钮时再次查询数据库(使用所选行中的某些参数)。

以下是单击“编辑”按钮时运行的查询。

function ShowPopupEditInventory(){

        $.when(getFocusedInventory()).then(function (x) {
            popupControlEditInventory.Show();
        });

        function getFocusedInventory(s, e) {
            grid.GetRowValues(grid.GetFocusedRowIndex(), 'StorageLocation;LP;Sku_Alpha;LotCode;ExpirationDate;FIFOReferenceDate;ManufactureDate;InventoryStatus;SellableUnitQuantity;ReceiveDate;InventoryDetailID;Area', getFocusedInventoryValues);
        }

        function getFocusedInventoryValues(values) {
            var fStorageLocation = values[0];
            var fLP = values[1];
            var fSku_Alpha = values[2];
            var fLotCode = values[3];
            var fExpirationDate = values[4];
            var fFIFOReferenceDate = values[5];
            var fManufactureDate = values[6];
            var fInventoryStatus = values[7];
            var fSellableUnitQuantity = values[8];
            var fReceiveDate = values[9];
            var fInventoryDetailID = values[10];
            var fArea = values[11];


            editInventoryStorageLocation.SetText(fStorageLocation);
            editInventoryLP.SetText(fLP);
            editInventoryItem.SetText(fSku_Alpha);
            editInventoryQty_OldValue.SetText(fSellableUnitQuantity);
            editInventorySts_OldValue.SetText(fInventoryStatus);
            editInventoryLot_OldValue.SetText(fLotCode);
            txtEditInventoryLot.SetText(fLotCode);
            $(".editInventoryLot").val(fLotCode);

            editInventoryStatus.SetValue(fInventoryStatus)
            editInventoryUnitQuantity.SetText(fSellableUnitQuantity);
            editInventoryDTL_No.SetText(fInventoryDetailID);
            editInventoryNotes.SetText('');
            $(".editInventoryAdjustmentCode").prop("selectedIndex", 0);
            editInventoryArea.SetText(fArea);


            editInventoryLot.Focus();

            btnOKEditInventory.SetEnabled(true);
        }
    }

0 个答案:

没有答案