protected void lbuRefresh_Click(object sender, EventArgs e) { ClearData(); ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition("", "", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void lbuSearch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchDegree.Text) && ddlSearchGroup.SelectedIndex == 0 && ddlSearchNameGroup.SelectedIndex == 0 && ddlSearchTypeName.SelectedIndex == 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { if (!string.IsNullOrEmpty(txtSearchDegree.Text)) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition(txtSearchDegree.Text, "", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } if (ddlSearchGroup.SelectedIndex != 0) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition("", ddlSearchGroup.SelectedValue, "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } if (ddlSearchNameGroup.SelectedIndex != 0) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition("", "", ddlSearchNameGroup.SelectedValue, ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } if (ddlSearchTypeName.SelectedIndex != 0) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition(txtSearchDegree.Text, "", "", ddlSearchTypeName.SelectedValue); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } } }
void BindData1() { if (!string.IsNullOrEmpty(txtSearchDegree.Text)) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition(txtSearchDegree.Text, "", "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } if (ddlSearchGroup.SelectedIndex != 0) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition("", ddlSearchGroup.SelectedValue, "", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } if (ddlSearchNameGroup.SelectedIndex != 0) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition("", "", ddlSearchNameGroup.SelectedValue, ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } if (ddlSearchTypeName.SelectedIndex != 0) { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition(txtSearchDegree.Text, "", "", ddlSearchTypeName.SelectedValue); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }
void BindData() { ClassPsPosition p = new ClassPsPosition(); DataTable dt = p.GetPsPosition("", "", "",""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }