void BindData1() { ClassStaffType s = new ClassStaffType(); DataTable dt = s.GetStaffTypeSearch(txtSearchStaffTypeID.Text, txtSearchStaffTypeName.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchStaffType_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchStaffTypeID.Text) && string.IsNullOrEmpty(txtSearchStaffTypeName.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassStaffType s = new ClassStaffType(); DataTable dt = s.GetStaffTypeSearch(txtSearchStaffTypeID.Text, txtSearchStaffTypeName.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }