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