private void LoadGrid() { int clientId = 0; DateTime startDate = DateTime.MinValue; DateTime endDate = DateTime.MinValue; // Client if (cboSubContractor.Text != "") { clientId = Convert.ToInt32(cboSubContractor.SelectedValue); } // Date Range if (dteStartDate.SelectedDate != DateTime.MinValue) { startDate = dteStartDate.SelectedDate.Value; } if (dteEndDate.SelectedDate != DateTime.MinValue) { endDate = dteEndDate.SelectedDate.Value; } bool posted = false; // Get Jobs to Invoice Facade.IInvoiceSubContrator facInvoice = new Facade.Invoice(); DataSet dsInvoicing; if (startDate != DateTime.MinValue || endDate != DateTime.MinValue) { dsInvoicing = facInvoice.GetSubContractorJobswithParamsAndDate(clientId, 0, posted, startDate, endDate); } else { dsInvoicing = facInvoice.GetSubContractorJobswithParams(clientId, 0, posted); } // Load List dvJobs.DataSource = dsInvoicing; DataView invoicableJobs = new DataView(dsInvoicing.Tables[0]); Session[C_EXPORTCSV_VS] = invoicableJobs.Table; // Bind jobs to datagrid dvJobs.DataBind(); lblJobCount.Text = "There are " + dsInvoicing.Tables[0].Rows.Count.ToString() + " sub contractors jobs ready to invoice."; pnlSubContractor.Visible = true; btnFilter.Visible = true; btnFilter1.Visible = true; btnClear.Visible = true; btnClear1.Visible = true; btnAssign.Visible = cboSubContractor.SelectedValue != ""; lblInvoiceNumber.Visible = cboSubContractor.SelectedValue != ""; txtInvoiceNumber.Visible = cboSubContractor.SelectedValue != ""; }