private void BindGrid(bool isSearch) { if (ddlDepName.SelectedIndex != -1 && isSearch) { Department obj = new Department(); obj.DepartmentID = int.Parse(ddlDepName.SelectedValue); DepartmentBLL depBll = new DepartmentBLL(); ds = depBll.GetById(obj); } else { ds = DepartmentBLL.GetAllDepartment(); } DepDisplayGrid.DataSource = ds; DepDisplayGrid.DataBind(); }