コード例 #1
0
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        Employee emp = (Employee)Session["emp"];

        if (Session["emp"] != null)
        {
            searchWord = txtSearch.Text;
            if (txtSearch.Text == String.Empty)
            {
                ClientScript.RegisterStartupScript(Page.GetType(),
                                                   "MessageBox",
                                                   "<script language='javascript'>alert('" + "Please enter value to search!" + "');</script>");
            }
            else
            {
                gvCollectionList.DataSource = RequisitionControl.DisplayCollectionListSearch(emp.DeptCode, searchWord.Trim());
                gvCollectionList.DataBind();
                ViewState["DataSource"] = "displaySearch";
                ViewState["searchWord"] = searchWord;
                showEmptyLabel();
            }
        }
        else

        {
            Utility.logout();
        }
    }
コード例 #2
0
    protected void GVCollectionList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        Employee emp = (Employee)Session["emp"];

        gvCollectionList.PageIndex = e.NewPageIndex;
        if (((string)ViewState["DataSource"]).Equals("displayAll"))
        {
            gvCollectionList.DataSource = RequisitionControl.getCollectionList(emp.DeptCode);
        }
        else
        {
            gvCollectionList.DataSource = RequisitionControl.DisplayCollectionListSearch(emp.DeptCode, ((string)ViewState["searchWord"]).Trim());
        }
        gvCollectionList.DataBind();
    }