public void BindDataGrid() { try { dtTotal = iTotal.GetInventoryBranchItemDetail(Request.QueryString["Period"].ToString(), Request.QueryString["Branch"].ToString(),pkgType); if (dtTotal != null && dtTotal.Rows.Count > 0) { if (Request.QueryString["ShowUsage"].ToString().ToLower() == "true") { dvBIOnhand.Columns[8].Visible = true; dvBIOnhand.Columns[9].Visible = true; dvBIOnhand.Columns[10].Visible = true; } else { dvBIOnhand.Columns[8].Visible = false; dvBIOnhand.Columns[9].Visible = false; dvBIOnhand.Columns[10].Visible = false; } dtTotal.DefaultView.Sort = Request.QueryString["Sort"].ToString(); dvBIOnhand.DataSource = dtTotal.DefaultView.ToTable(); dvBIOnhand.DataBind(); dvBIOnhand.Visible = true; lblStatus.Visible = false; } else { dvBIOnhand.Visible = false; lblStatus.Visible = true; lblStatus.Text = "No Records Found"; } } catch (Exception ex) { throw; } }
public void BindDataGrid() { try { if (sort == "") { lblPeriod.Text = "Period : " + cldStartDt.SelectedDate.ToShortDateString(); hidPeriod.Value = cldStartDt.SelectedDate.ToShortDateString(); //dtTotal = iTotal.GetInventoryBranchItemDetail(cldStartDt.SelectedDate.ToShortDateString(), branchID); } if (ddlPkgType.SelectedValue == "ALL") //if (Session["DropDownSelVal"] == "ALL") // if (ddlPkgType.SelectedValue = Session["DropDownSelVal"]) { dtTotal = iTotal.GetInventoryBranchItemDetail(hidPeriod.Value, branchID, ddlPkgType.SelectedValue = "ALL"); //Pete added 11/17/2011 // dtTotal = iTotal.GetInventoryBranchItemDetail(hidPeriod.Value, branchID, iTotal.GetBranchInventoryOnHand(hidPkgType1.PkgType)); //Pete added 04/13/2012 // dtTotal = iTotal.GetInventoryBranchItemDetail(hidPeriod.Value, branchID, iTotal.GetBranchInventoryOnHand(hidPkgType1.Value)); //Pete added 04/13/2012 } else if (ddlPkgType.SelectedValue == "PKG") //else if (Session["DropDownSelVal"] == "PKG") { dtTotal = iTotal.GetInventoryBranchItemDetail(hidPeriod.Value, branchID, ddlPkgType.SelectedValue = "PKG"); //Pete added 11/17/2011 } else if (ddlPkgType.SelectedValue == "BULK") //else if (sav == "BULK") { dtTotal = iTotal.GetInventoryBranchItemDetail(hidPeriod.Value, branchID, ddlPkgType.SelectedValue = "BULK"); //Pete added 11/17/2011 } else { dtTotal = iTotal.GetInventoryBranchItemDetail(hidPeriod.Value, branchID); } if (dtTotal !=null && dtTotal.Rows.Count > 0) { if (chkShowUsage.Checked) { dvBIOnhand.Columns[9].Visible = true; dvBIOnhand.Columns[10].Visible = true; dvBIOnhand.Columns[11].Visible = true; } else { dvBIOnhand.Columns[9].Visible = false; dvBIOnhand.Columns[10].Visible = false; dvBIOnhand.Columns[11].Visible = false; } sortExpression = ((hidSort.Value != "") ? hidSort.Value : "ItemNo asc"); dtTotal.DefaultView.Sort = sortExpression; dvBIOnhand.DataSource = dtTotal.DefaultView.ToTable(); Pager.InitPager(dvBIOnhand, pagesize); dvBIOnhand.Visible = true; lblStatus.Visible = false; Pager.Visible = true; } else { dvBIOnhand.Visible = false; lblStatus.Visible = true; Pager.Visible = false; lblStatus.Text = "No Records Found"; } upnlGrid.Update(); if (hidShowMode.Value == "Show") ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShoW", "ShowPanel();", true); else if (hidShowMode.Value == "ShowL") ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShoWL", "ShowHide('Show');", true); else if (hidShowMode.Value == "HideL") ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShoWL", "ShowHide('Hide');", true); } catch (Exception ex) { throw; } }