protected void lbuRefresh_Click(object sender, EventArgs e) { ClearData(); ClassDivision d = new ClassDivision(); DataTable dt = d.GetDivision("", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
void BindData() { ClassDivision d = new ClassDivision(); DataTable dt = d.GetDivision("", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
void BindData1() { if (!string.IsNullOrEmpty(txtSearchDivisionName.Text)) { ClassDivision d1 = new ClassDivision(); DataTable dt1 = d1.GetDivision(txtSearchDivisionName.Text, "", ""); GridView1.DataSource = dt1; GridView1.DataBind(); SetViewState(dt1); } if (ddlSearchCampus.SelectedIndex != 0) { ClassDivision d2 = new ClassDivision(); DataTable dt2 = d2.GetDivision("", ddlSearchCampus.SelectedValue, ""); GridView1.DataSource = dt2; GridView1.DataBind(); SetViewState(dt2); } if (ddlSearchFaculty.SelectedIndex != 0) { ClassDivision d3 = new ClassDivision(); DataTable dt3 = d3.GetDivision("", "", ddlSearchFaculty.SelectedValue); GridView1.DataSource = dt3; GridView1.DataBind(); SetViewState(dt3); } }
protected void lbuSearch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchDivisionName.Text) && ddlSearchCampus.SelectedIndex == 0 && ddlSearchFaculty.SelectedIndex == 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { if (!string.IsNullOrEmpty(txtSearchDivisionName.Text)) { ClassDivision d1 = new ClassDivision(); DataTable dt1 = d1.GetDivision(txtSearchDivisionName.Text, "", ""); GridView1.DataSource = dt1; GridView1.DataBind(); SetViewState(dt1); } if (ddlSearchCampus.SelectedIndex != 0) { ClassDivision d2 = new ClassDivision(); DataTable dt2 = d2.GetDivision("", ddlSearchCampus.SelectedValue, ""); GridView1.DataSource = dt2; GridView1.DataBind(); SetViewState(dt2); } if (ddlSearchFaculty.SelectedIndex != 0) { ClassDivision d3 = new ClassDivision(); DataTable dt3 = d3.GetDivision("", "", ddlSearchFaculty.SelectedValue); GridView1.DataSource = dt3; GridView1.DataBind(); SetViewState(dt3); } } }