//排序 protected void Grid_Material_Sorting(object sender, GridViewSortEventArgs e) { // 从事件参数获取排序数据列 string sortExpression = e.SortExpression.ToString(); // 假定为排序方向为“顺序” string sortDirection = "ASC"; // “ASC”与事件参数获取到的排序方向进行比较,进行GridView排序方向参数的修改 if (sortExpression == Grid_Material.Attributes["SortExpression"]) { //获得下一次的排序状态 sortDirection = (Grid_Material.Attributes["SortDirection"].ToString() == sortDirection ? "DESC" : "ASC"); } // 重新设定GridView排序数据列及排序方向 Grid_Material.Attributes["SortExpression"] = sortExpression; Grid_Material.Attributes["SortDirection"] = sortDirection; //重新绑定数据 Grid_Material.DataBind(); }
//翻页 protected void Grid_Material_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_Material.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; } BindGridMa(Bindc1, Bindc2); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_Material.PageCount ? Grid_Material.PageCount - 1 : newPageIndex; Grid_Material.PageIndex = newPageIndex; Grid_Material.DataBind(); }
//翻页 protected void Grid_Material_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_Material.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 (state == "") //{ // Label7.Text = "待审核物料信息表"; // Grid_Material.Columns[14].Visible = true; // Grid_Material.Columns[15].Visible = false; //} //else if (state == "all") //{ // Label7.Text = "历史检验信息表"; // Grid_Material.Columns[14].Visible = false; // Grid_Material.Columns[15].Visible = true; //} BindGrid1(Label30.Text); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_Material.PageCount ? Grid_Material.PageCount - 1 : newPageIndex; Grid_Material.PageIndex = newPageIndex; Grid_Material.DataBind(); }
//翻页 protected void Grid_Material_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_Material.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 (condSearch1 == "") //{ // cond1 = " and IMMBD_IsIQC=1"; //} //else if (condSearch1 == "all") //{ // cond1 = " and (IMMBD_IsIQC=0 or IMMBD_IsIQC is null) "; //} BindGrid1(cond1); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_Material.PageCount ? Grid_Material.PageCount - 1 : newPageIndex; Grid_Material.PageIndex = newPageIndex; Grid_Material.DataBind(); }
//绑定进料检验物料Gridview private void BindGrid1(string condition) { Grid_Material.DataSource = iQCBasicDataL.Search_IMMaterialBasicData_IQC(condition); Grid_Material.DataBind(); }
//绑定物料Gridview private void BindGridMa(string condition1, string condition2) { Grid_Material.DataSource = hSFBasicDataL.Search_IMMaterialBasicData_M1(condition1, condition2); Grid_Material.DataBind(); }
//绑定认证产品型号Gridview1 private void BindGrid1(string Condition) { Grid_Material.DataSource = iQCBasicDataL.Search_IMInStoreDetail_IQC(Condition); Grid_Material.DataBind(); }
//绑定模糊检索某风险等级下物料Gridview private void BindGridMRiskF(Guid ID, string cond1, string cond2) { Grid_Material.DataSource = hSFBasicDataL.Search_IMMaterialBasicData_RL(ID, cond1, cond2); Grid_Material.DataBind(); }
//绑定某风险等级下物料Gridview private void BindGridMRisk(Guid ID) { Grid_Material.DataSource = hSFBasicDataL.Search_HSFReskLevel_M(ID); Grid_Material.DataBind(); }
//绑定所有物料Gridview private void BindGridMAll(string IMMT_MaterialType, string IMMBD_MaterialName) { Grid_Material.DataSource = hSFBasicDataL.Search_IMMaterialBasicData_M(IMMT_MaterialType, IMMBD_MaterialName); Grid_Material.DataBind(); }