void BindData1() { ClassAmphur a = new ClassAmphur(); DataTable dt = a.GetAmphurSearch(txtSearchAmphurID.Text, txtSearchAmphurTH.Text, txtSearchAmphurEN.Text, txtSearchProvinceID.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchAmphur_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchAmphurID.Text) && string.IsNullOrEmpty(txtSearchAmphurTH.Text) && string.IsNullOrEmpty(txtSearchAmphurEN.Text) && string.IsNullOrEmpty(txtSearchProvinceID.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassAmphur a = new ClassAmphur(); DataTable dt = a.GetAmphurSearch(txtSearchAmphurID.Text, txtSearchAmphurTH.Text, txtSearchAmphurEN.Text, txtSearchProvinceID.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }