void BindData1() { ClassFaculty f = new ClassFaculty(); DataTable dt = f.GetFacultySearch(txtSearchFacultyID.Text, txtSearchFacultyName.Text, txtSearchCampusID.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchFaculty_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchFacultyID.Text) && string.IsNullOrEmpty(txtSearchFacultyName.Text) && string.IsNullOrEmpty(txtSearchCampusID.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassFaculty f = new ClassFaculty(); DataTable dt = f.GetFacultySearch(txtSearchFacultyID.Text, txtSearchFacultyName.Text, txtSearchCampusID.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }