protected void Button2_Click(object sender, EventArgs e) { EmployeeLogic el = new EmployeeLogic(); Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"])); if (e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE")) { QuotationLogic ql = new QuotationLogic(); DateTime d1 = new DateTime(); DateTime d2 = new DateTime(); if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1)) { d1 = DateTime.Now.AddYears(-100); } if (!DateTime.TryParseExact(TextBox2.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d2)) { d2 = DateTime.Now.AddYears(10); } DataTable dt = ql.Search(Convert.ToInt32(DropDownList1.SelectedItem.Value), Convert.ToInt32(DropDownList2.SelectedItem.Value), d1, d2); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label1.Visible = true; } else { Table1.Visible = true; Label1.Visible = false; } } else { Response.Redirect("Access.aspx"); } }