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_GETCHALLENLISTResult> lst = new List <USP_VP_GETCHALLENLISTResult>(); lst = MyDa.USP_VP_GETCHALLENLIST(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].T012_NETAMOUNT.Value; } lblNetTotal.Text = dTotal.ToString(); dgDisplayData.Columns["T012_CHALLENID"].Visible = false; dgDisplayData.Columns["T001_ACCOUNTID"].Visible = false; dgDisplayData.Columns["T012_DETAILS"].Visible = false; dgDisplayData.Columns["T012_TOTAL_AMT"].Visible = false; dgDisplayData.Columns["T012_DISCOUNT"].Visible = false; dgDisplayData.Columns["T012_TAX"].Visible = false; dgDisplayData.Columns["T001_CONTACT_PERSON"].Visible = false; dgDisplayData.Columns["T001_MOBILE1"].Visible = false; dgDisplayData.Columns["T001_NAME"].HeaderText = "Name"; dgDisplayData.Columns["T012_TRANSPORT1"].HeaderText = "Transport"; dgDisplayData.Columns["T012_LR1"].HeaderText = "L.R.No"; dgDisplayData.Columns["T012_TRANSPORT2"].HeaderText = "Parcel"; dgDisplayData.Columns["T012_DATE"].HeaderText = "Date"; dgDisplayData.Columns["T012_DATE"].DefaultCellStyle.Format = "dd-MM-yyyy"; dgDisplayData.Columns["T012_NO"].HeaderText = "Invoice No"; dgDisplayData.Columns["T012_NETAMOUNT"].HeaderText = "Net Amount"; dgDisplayData.Columns["T001_NAME"].DisplayIndex = 0; dgDisplayData.Columns["T012_DATE"].DisplayIndex = 1; dgDisplayData.Columns["T012_NO"].DisplayIndex = 2; dgDisplayData.Columns["T012_NETAMOUNT"].DisplayIndex = 3; dgDisplayData.Columns["T012_TRANSPORT1"].DisplayIndex = 4; dgDisplayData.Columns["T012_LR1"].DisplayIndex = 5; dgDisplayData.Columns["T012_TRANSPORT2"].DisplayIndex = 6; 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.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("Tahoma", 12F, FontStyle.Bold, GraphicsUnit.Pixel); dgDisplayData.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; }