void PopualteData() { string TM02_PARTYID = ""; int iTM02_PARTYID = 0; if (!string.IsNullOrEmpty(cmbName.Text.Trim())) { int.TryParse(cmbName.SelectedValue.ToString(), out iTM02_PARTYID); } if (iTM02_PARTYID > 0) { TM02_PARTYID = iTM02_PARTYID.ToString(); } decimal dTotal = 0; MyDa = new MyDabaseDataContext(Properties.Settings.Default.Style_King_Dev); List <USP_VP_GETSALELISTResult> lst = new List <USP_VP_GETSALELISTResult>(); lst = MyDa.USP_VP_GETSALELIST(null, TM02_PARTYID, null, dtpFromDate.Value, dtpTodate.Value, Datalayer.iT001_COMPANYID.ToString()).ToList(); dgDisplayData.DataSource = lst; for (int i = 0; i < lst.Count; i++) { dTotal = dTotal + lst[i].T007_NETAMOUNT.Value; } lblNetTotal.Text = dTotal.ToString(); dgDisplayData.Columns["T007_SALEID"].Visible = false; dgDisplayData.Columns["T001_ACCOUNTID"].Visible = false; dgDisplayData.Columns["T007_DETAILS"].Visible = false; dgDisplayData.Columns["T007_TOTAL_AMT"].Visible = false; dgDisplayData.Columns["T007_DISCOUNT"].Visible = false; // dgDisplayData.Columns["T007_TAX"].Visible = false; dgDisplayData.Columns["T001_CONTACT_PERSON"].Visible = false; dgDisplayData.Columns["T001_MOBILE1"].Visible = false; dgDisplayData.Columns["T007_CGST"].Visible = false; dgDisplayData.Columns["T007_SGST"].Visible = false; dgDisplayData.Columns["T007_IGST"].Visible = false; dgDisplayData.Columns["T001_NAME"].HeaderText = "Name"; dgDisplayData.Columns["T001_MOBILE1"].HeaderText = "Mobile No"; dgDisplayData.Columns["T007_DATE"].HeaderText = "Date"; dgDisplayData.Columns["T007_DATE"].DefaultCellStyle.Format = "dd-MM-yyyy"; dgDisplayData.Columns["T007_NO"].HeaderText = "Invoice No"; dgDisplayData.Columns["T007_NETAMOUNT"].HeaderText = "Net Amount"; dgDisplayData.Columns["T007_TRANSPORT1"].HeaderText = "Transport"; dgDisplayData.Columns["T007_TRANSPORT2"].HeaderText = "Parcels"; dgDisplayData.Columns["T007_LR1"].HeaderText = "L.R.No"; dgDisplayData.Columns["List_Output"].HeaderText = "Items"; this.dgDisplayData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgDisplayData.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(Datalayer.sGridHeaderColor1, Datalayer.sGridHeaderColor2, Datalayer.sGridHeaderColor3); dgDisplayData.EnableHeadersVisualStyles = false; this.dgDisplayData.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; // dgCategory.CurrentRow.DefaultCellStyle.BackColor = Color.White; dgDisplayData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; dgDisplayData.ColumnHeadersHeight = 30; dgDisplayData.Columns["List_Output"].DefaultCellStyle.WrapMode = DataGridViewTriState.True; dgDisplayData.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dgDisplayData.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("Tahoma", 12F, FontStyle.Bold, GraphicsUnit.Pixel); dgDisplayData.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; dgDisplayData.Columns["T001_NAME"].Width = 200; dgDisplayData.Columns["T001_MOBILE1"].Width = 75; dgDisplayData.Columns["T007_DATE"].Width = 90; dgDisplayData.Columns["T007_NO"].Width = 75; dgDisplayData.Columns["T007_NETAMOUNT"].Width = 100; dgDisplayData.Columns["T007_TRANSPORT1"].Width = 100; dgDisplayData.Columns["T007_TRANSPORT2"].Width = 100; dgDisplayData.Columns["T007_LR1"].Width = 100; dgDisplayData.Columns["List_Output"].Width = 300; }