protected void imgbtnShipmentEdit_Click(object sender, ImageClickEventArgs e) { List <LC_Shipment> Shipment = new List <LC_Shipment>(); ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; try { string ShipmentId = ""; Label lblShipment_Id = (Label)gridShipment.Rows[row.RowIndex].FindControl("lblShipment_Id"); if (lblShipment_Id != null) { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; ShipmentId = lblShipment_Id.Text; Shipment = masterBLL.GetShipmentDetailsByIdandOcode(ShipmentId, OCODE); if (Shipment.Count > 0) { foreach (LC_Shipment ship in Shipment) { hidshipmentid.Value = ship.Shipment_Id.ToString(); txtLCNumber.Text = ship.LC_No; txtLCReceiveDate.Text = ConvertDate(ship.LC_ReceiveDate.ToString()); txtFeederVessel.Text = ship.Feeder_Vessel; txtETD.Text = ConvertDate(ship.FETA.ToString()); txtETA.Text = ConvertDate(ship.FETD.ToString()); txtActualShipQuantity.Text = Convert.ToString(ship.Actual_Ship_Qty); txtAirwayBill.Text = ship.Airway_Bill; txtExportLicenseNumber.Text = ship.Export_License_No; txtGSPForm.Text = ship.GSP_Form; txtCourierNumber.Text = ship.Courier_No; txtDebitNoteNo.Text = ship.Debit_Note_No; txtDocumentReceiveDate.Text = ConvertDate(ship.Document_Receive_Date.ToString()); txtActualFCRDate.Text = ConvertDate(ship.Actual_FCR_Date.ToString()); txtLCDate.Text = ConvertDate(ship.LC_Date.ToString()); txtLCExpiryDate.Text = ConvertDate(ship.LC_Expiry_Date.ToString()); txtMotherVessel.Text = ship.Mother_Vessel; txtETD1.Text = ConvertDate(ship.METD.ToString()); txtETA1.Text = ConvertDate(ship.META.ToString()); txtInvoiceNumber.Text = ship.Invoice_No; txtContainerNumber.Text = ship.Container_No; txtCertificateOfOrigin.Text = ship.Certificate_Of_Origin; txtCommissionRate.Text = Convert.ToString(ship.Commission_Rate); txtCourierDate.Text = ConvertDate(ship.Courier_Date.ToString()); txtInspectionCertificationNo.Text = ship.Inspection_Certificate_No; txtPackingListNumber.Text = ship.Packing_List_No; txtOther.Text = ship.Others; if (btnShipment.Text == "Save") { btnShipment.Text = "Update"; } } } } } catch (Exception ex) { throw ex; } }