예제 #1
0
 protected void btnExcel_Click(object sender, EventArgs e)
 {
     Grid_ProType.AllowPaging  = false;
     Grid_ProType.AllowSorting = false;
     Grid_ProType.DataBind();
     ExcelHelper.GridViewToExcel(Grid_ProType, "产品型号说明表");
     Grid_ProType.AllowSorting = true;
 }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Labelpeople.Text = Session["UserName"].ToString();
        Labeltime.Text   = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
        string ProSeries = Request.QueryString["ProSeries"] == "" ? " and 1=1 " : " and PS_Name like '%" + Request.QueryString["ProSeries"] + "%' ";
        string PTName    = Request.QueryString["PTName"] == "" ? " and 1=1 " : " and PT_Name like '%" + Request.QueryString["PTName"] + "%' ";
        string PTCode    = Request.QueryString["PTCode"] == "" ? " and 1=1 " : " and PT_Code like '%" + Request.QueryString["PTCode"] + "%' ";
        string condition;

        condition = ProSeries + PTName + PTCode;

        Grid_ProType.DataSource = pbInfo.SearchPBTypeInfo(condition);
        Grid_ProType.DataBind();
    }
예제 #3
0
    private void DataBindAll()
    {
        string condition;

        string ProSeries = TxtProSeries.Text.Trim() == "" ? " and 1=1 " : " and PS_Name like '%" + TxtProSeries.Text.Trim() + "%' ";
        string PTName    = TxtProType.Text.Trim() == "" ? " and 1=1 " : " and PT_Name like '%" + TxtProType.Text.Trim() + "%' ";
        string PTCode    = TxtProCode.Text.Trim() == "" ? " and 1=1 " : " and PT_Code like '%" + TxtProCode.Text.Trim() + "%' ";;

        condition = ProSeries + PTName + PTCode;
        try
        {
            Grid_ProType.DataSource = pbInfo.SearchPBTypeInfo(condition);
        }
        catch (Exception)
        {
            throw;
        }

        Grid_ProType.DataBind();
        UpdatePanel_ProType.Update();
    }
예제 #4
0
    //翻页
    protected void Grid_ProType_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        {
            TextBox     txtNewPageIndex = null;
            GridViewRow pagerRow        = Grid_ProType.BottomPagerRow;


            if (null != pagerRow)
            {
                txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox");   // refer to the TextBox with the NewPageIndex value
            }

            if (null != txtNewPageIndex && txtNewPageIndex.Text != "")
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
            }
        }
        else
        {
            newPageIndex = e.NewPageIndex;
        }
        if (condSearch.Text == "")
        {
            BindGrid1RZ(PS_Name, PT_Name);
        }
        else if (condSearch.Text == "QT")
        {
            BindGrid1QT(PS_Name, PT_Name);
        }
        newPageIndex           = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex           = newPageIndex >= Grid_ProType.PageCount ? Grid_ProType.PageCount - 1 : newPageIndex;
        Grid_ProType.PageIndex = newPageIndex;
        Grid_ProType.DataBind();
    }
예제 #5
0
 //绑定其他产品型号Gridview1
 private void BindGrid1QT(string PS_Name, string PT_Name)
 {
     Grid_ProType.DataSource = iQCBasicDataL.Search_ProType_QT(PS_Name, PT_Name);
     Grid_ProType.DataBind();
 }