protected void btnFilter_Click(object sender, EventArgs e) { if (ddlPayment.SelectedItem.Text == "All") { BindGridView(); txtEndDate.Enabled = false; txtStartDate.Enabled = false; btnFilter.Enabled = false; } else { _invMstr.CompanyId = Convert.ToInt16(Session["CompanyId"]); _invMstr.PaymentStatus = Convert.ToInt16(ddlPayment.SelectedItem.Value); DateTime StartDate = Convert.ToDateTime(txtStartDate.Text); DateTime EndDate = Convert.ToDateTime(txtEndDate.Text); _ds.Tables.Add(_sobj.SelectInvoiceDate(_invMstr, StartDate, EndDate)); gvInvoice.DataSource = _ds; gvInvoice.DataBind(); txtEndDate.Enabled = true; txtStartDate.Enabled = true; btnFilter.Enabled = true; } }