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