Esempio n. 1
0
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        Employee emp = (Employee)Session["emp"];

        searchWord = txtSearch.Text;
        if (String.IsNullOrWhiteSpace(searchWord))
        {
            ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Please enter value to search!" + "');</script>");
        }
        else
        {
            if (ddlStatus.SelectedItem.ToString() == "Select Status")
            {
                gvRequisitionForm.DataSource = RequisitionControl.HeadSearchWithoutStatus(searchWord.Trim(), emp.DeptCode);
                gvRequisitionForm.DataBind();
                ViewState["DataSource"]   = "displaySearch";
                ViewState["searchString"] = searchWord;
                showEmptyLabel();
            }
            else
            {
                gvRequisitionForm.DataSource = RequisitionControl.HeadSearchWithStatus(searchWord.Trim(), emp.DeptCode, ddlStatus.SelectedItem.ToString());
                gvRequisitionForm.DataBind();
                ViewState["DataSource"]   = "displaySearchStatus";
                ViewState["searchString"] = searchWord;
                showEmptyLabel();
            }
        }
    }
Esempio n. 2
0
    protected void GvRequisitionForm_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        Employee emp = (Employee)Session["emp"];

        gvRequisitionForm.PageIndex = e.NewPageIndex;
        if (((string)ViewState["DataSource"]).Equals("displayAll"))
        {
            gvRequisitionForm.DataSource = RequisitionControl.DisplayAllByDeptCode(emp.DeptCode);
        }
        else if (((string)ViewState["DataSource"]).Equals("displayStatusSearch"))
        {
            gvRequisitionForm.DataSource = RequisitionControl.getRequisitionListByStatusAndDepCode(ddlStatus.SelectedItem.ToString(), emp.DeptCode);
        }
        else if (((string)ViewState["DataSource"]).Equals("displaySearch"))
        {
            gvRequisitionForm.DataSource = RequisitionControl.HeadSearchWithoutStatus(((string)ViewState["searchString"]).Trim(), emp.DeptCode);
        }
        else if (((string)ViewState["DataSource"]).Equals("displaySearchStatus"))
        {
            gvRequisitionForm.DataSource = RequisitionControl.HeadSearchWithStatus(((string)ViewState["searchString"]).Trim(), emp.DeptCode, ddlStatus.SelectedItem.ToString());
        }
        gvRequisitionForm.DataBind();
    }