void BindData1() { ClassMonth m = new ClassMonth(); DataTable dt = m.GetMonthSearch(txtSearchMonthID.Text, txtSearchMonthNameSmall.Text, txtSearchMonthNameFull.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchMonth_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchMonthID.Text) && string.IsNullOrEmpty(txtSearchMonthNameSmall.Text) && string.IsNullOrEmpty(txtSearchMonthNameFull.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassMonth m = new ClassMonth(); DataTable dt = m.GetMonthSearch(txtSearchMonthID.Text, txtSearchMonthNameSmall.Text, txtSearchMonthNameFull.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }