protected void Button_SearchBatch_Click(object sender, EventArgs e) { string condition = this.TextBox_MBatch.Text.Trim() == "" ? " and 1=1 " : " and IMID_BatchNum like '%" + this.TextBox_MBatch.Text.Trim() + "%' "; GridView_BasicBatch.DataSource = wol.S_WOMBatchNum_IMInventoryDetail(" and c.IMMBD_MaterialID='" + this.Label_iMMBD_MaterialID.Text + "' and IMID_BatchNum not in ( select WOMBN_BN from WOMBatchNum d where d.WO_ID='" + this.Label_WOID.Text + "' and d.IMMBD_MaterialID ='" + this.Label_iMMBD_MaterialID.Text + "')" + condition); GridView_BasicBatch.DataBind(); UpdatePanel_MBatch.Update(); }
protected void Button_ChooseBatch_Click(object sender, EventArgs e) { TextBox_MBatch.Text = ""; Panel_MBatch.Visible = true; GridView_BasicBatch.DataSource = wol.S_WOMBatchNum_IMInventoryDetail(" and c.IMMBD_MaterialID='" + this.Label_iMMBD_MaterialID.Text + "' and IMID_BatchNum not in ( select WOMBN_BN from WOMBatchNum d where d.WO_ID='" + this.Label_WOID.Text + "' and d.IMMBD_MaterialID ='" + this.Label_iMMBD_MaterialID.Text + "')"); GridView_BasicBatch.DataBind(); UpdatePanel_MBatch.Update(); }
protected void GridView_BasicBatch_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; GridView_BasicBatch.SelectedIndex = -1; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView_BasicBatch.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; } } else { newPageIndex = e.NewPageIndex; } newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView_BasicBatch.PageCount ? GridView_BasicBatch.PageCount - 1 : newPageIndex; GridView_BasicBatch.PageIndex = newPageIndex; string condition = this.TextBox_MBatch.Text.Trim() == "" ? " and 1=1 " : " and IMID_BatchNum like '%" + this.TextBox_MBatch.Text.Trim() + "%' "; GridView_BasicBatch.DataSource = wol.S_WOMBatchNum_IMInventoryDetail(" and c.IMMBD_MaterialID='" + this.Label_iMMBD_MaterialID.Text + "' and IMID_BatchNum not in ( select WOMBN_BN from WOMBatchNum d where d.WO_ID='" + this.Label_WOID.Text + "' and d.IMMBD_MaterialID ='" + this.Label_iMMBD_MaterialID.Text + "')" + condition); GridView_BasicBatch.DataBind(); UpdatePanel_MBatch.Update(); }