void btnMatchOrder_Click(object sender, EventArgs e) { int itemID = -1; int.TryParse(hdnItemID.Value, out itemID); if (this.ImportedInvoiceItemId == -1) { if (itemID > 0) { Entities.PalletForceImportedInvoiceItem pfInvoiceItem = PFInvoice.PalletForceImportedInvoiceItems.SingleOrDefault(pfiii => pfiii.PalletForceImportedItemID == PFInvoiceItemID); if (pfInvoiceItem != null) { pfInvoiceItem.OrderID = itemID; } } Facade.IPalletForceImportPreInvoice facPFIPreInvoice = new Facade.PreInvoice(); bool retVal = facPFIPreInvoice.UpdatePalletForcePreInvoiceItem(PFInvoice, PFInvoiceItemID, PreInvoiceID, ((Entities.CustomPrincipal)Page.User).UserName); if (retVal) { this.ReturnValue = bool.TrueString; this.Close(); } } else if (itemID > 0) { // if this was called from the invoicingImport then we just want to return the importedInvoiceItemId and the ORder selected. this.ReturnValue = ImportedInvoiceItemId.ToString() + "," + itemID.ToString(); this.Close(); } }