private void GetData() { try { if (cmb_days.Text.Trim() != "") { int did = commonFunctions.ToInt(cmb_days.SelectedValue.ToString().Trim()); int Sid = commonFunctions.ToInt(cmb_Shifts.SelectedValue.ToString().Trim()); dgmain.AutoGenerateColumns = false; List <TotalizeReadingViewModel> stl = CustomeRepository.GetAllTotalizerForDay(did, Sid).ToList(); if (stl != null) { dgmain.DataSource = stl; } } } catch (Exception ex) { MessageBox.Show("Error Has found when loading data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }