Hi,
private void BindGridView(DateTime HireDate)
{
string ConString = ConfigurationManager.ConnectionStrings["ConString2"].ConnectionString;
SqlConnection con = new SqlConnection(ConString);
string CmdString = "Select EmployeeID, FirstName, LastName, Salary, HireDate FROM Employees ORDER BY Salary DESC";
SqlCommand cmd = new SqlCommand(CmdString, con);
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(ds);
DataView dv = ds.Tables[0].DefaultView;
dv.RowFilter = "HireDate='"+HireDate+"'";
GridView2.DataSource = dv;
GridView2.DataBind();
}
You can call this function from different buttons as per your need