protected void imgbtnOrderSheetView_Click(object sender, ImageClickEventArgs e) { List <BuyingHouseReport> orders = new List <BuyingHouseReport>(); ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; try { //string orderId = ""; Label lblOrderEntryID = (Label)grdorder.Rows[row.RowIndex].FindControl("lblOrderEntryID"); if (lblOrderEntryID != null) { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; int orderId = Convert.ToInt32(lblOrderEntryID.Text); orders = masterBLL.GetLCOrderGridByOrderNo(orderId, OCODE); if (orders.Count > 0) { var order = orders.FirstOrDefault(); hidorderid.Value = order.OrderEntryID.ToString(); lblOrderNo.Text = order.Order_No; lblStyle.Text = order.Style_Description; lblPrincipal.Text = order.PrincipalName; lblBuyer.Text = order.Buyer_Name; lblOrderQty.Text = order.OrderQuantity.ToString(); DateTime ShipmentDate_ = Convert.ToDateTime(order.ShipmentDate); lblShipmentDate.Text = ShipmentDate_.ToString("MM/dd/yyyy"); lblTotal_Amount.Text = order.Total_Amount.ToString(); lblFobQty.Text = order.FobQty.ToString(); lblSeasonName.Text = order.SeasonName; lblShipment_Mode.Text = order.Shipment_Mode; lblFactoryName.Text = order.FactoryName; lblGender.Text = order.Gender; lblBuyer_Department.Text = order.Buyer_Department; lblYarn_Fabrication.Text = order.Yarn_Fabrication; lblFOB_Port.Text = order.FOB_Port; lblCountryof_Production.Text = order.Countryof_Production; lblStyle_Category.Text = order.Style_Category; lblFullName.Text = order.FullName; } showInfo.Visible = true; } } catch (Exception ex) { throw ex; } }