protected void orderListButton_Click(object sender, EventArgs e) { SalesOrderBLL salesOrder = new SalesOrderBLL(); try { if (salesCenterDropDownList.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Sales Center Name field is required."; } else if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required."; } else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required."; } else { string salesCenterId = salesCenterDropDownList.SelectedValue.Trim(); string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()); string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()); string status = statusDropDownList.SelectedValue.Trim(); DataTable dt = salesOrder.GetSalesOrdersListBySalesCenterDateRangeAndStatus(salesCenterId, fromDate, toDate, status); salesOrderListGridView.DataSource = dt; salesOrderListGridView.DataBind(); if (salesOrderListGridView.Rows.Count > 0) { salesOrderListGridView.UseAccessibleHeader = true; salesOrderListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text ="Somethings goes wrong in Order List"+ ex.Message; } finally { salesOrder = null; } }