protected void ProdDisplayGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { ProdDisplayGrid.PageIndex = e.NewPageIndex; if (Session["SortedView"] != null) { ProdDisplayGrid.DataSource = Session["SortedView"]; ProdDisplayGrid.DataBind(); } else { ProdDisplayGrid.DataSource = ds; ProdDisplayGrid.DataBind(); } BindGrid(false); }
private void BindGrid(bool isDrpSelection) { ProductMaster obj = new ProductMaster(); if (drpSerchProduct.SelectedValue != "" && isDrpSelection) { obj.ProductID = Convert.ToInt32(drpSerchProduct.SelectedValue); ds = ProductMasterBLL.GetProductMasterByID(obj); ProdDisplayGrid.DataSource = ds; ProdDisplayGrid.DataBind(); } else { ds = ProductMasterBLL.GetAllProductMaster(); ProdDisplayGrid.DataSource = ds; ProdDisplayGrid.DataBind(); } }
private void BindGrid(bool drpSelected) { if (drpSerchUser.SelectedValue != "" && drpSelected) { StockDetails objdrp = new StockDetails(); objdrp.ProductID = Convert.ToInt32(drpSerchUser.SelectedValue); objdrp.UserRoleID = Convert.ToInt32(Session["UserID"]); ds = stockDetailsBll.GetStockDetailSearch(objdrp); ProdDisplayGrid.DataSource = ds; ProdDisplayGrid.DataBind(); } else { StockDetails obj1 = new StockDetails(); obj1.UserRoleID = Convert.ToInt32(Session["UserID"]); ds = stockDetailsBll.GetStockDetailSearch(obj1); ProdDisplayGrid.DataSource = ds; ProdDisplayGrid.DataBind(); } }
protected void ProdDisplayGrid_Sorting(object sender, GridViewSortEventArgs e) { DataView sortedView; string sortingDirection = string.Empty; if (direction == SortDirection.Ascending) { direction = SortDirection.Descending; sortingDirection = "Desc"; } else { direction = SortDirection.Ascending; sortingDirection = "Asc"; } if (drpSerchUser.SelectedIndex != -1) { StockDetails objsort = new StockDetails(); objsort.ProductID = Convert.ToInt32(drpSerchUser.SelectedValue); ds = stockDetailsBll.GetStockDetailSearch(objsort); ProdDisplayGrid.DataSource = ds; ProdDisplayGrid.DataBind(); } else { StockDetails objGrid = new StockDetails(); objGrid.UserRoleID = Convert.ToInt32(Session["UserID"]); ds = stockDetailsBll.GetStockDetailSearch(objGrid); } ProdDisplayGrid.DataSource = ds; sortedView = new DataView(ds.Tables[0]); sortedView.Sort = e.SortExpression + " " + sortingDirection; Session["SortedView"] = sortedView; ProdDisplayGrid.DataSource = sortedView; ProdDisplayGrid.DataBind(); }
protected void ProdDisplayGrid_Sorting(object sender, GridViewSortEventArgs e) { DataView sortedView; string sortingDirection = string.Empty; if (direction == SortDirection.Ascending) { direction = SortDirection.Descending; sortingDirection = "Desc"; } else { direction = SortDirection.Ascending; sortingDirection = "Asc"; } ds = ProductMasterBLL.GetAllProductMaster(); ProdDisplayGrid.DataSource = ds; sortedView = new DataView(ds.Tables[0]); sortedView.Sort = e.SortExpression + " " + sortingDirection; Session["SortedView"] = sortedView; ProdDisplayGrid.DataSource = sortedView; ProdDisplayGrid.DataBind(); }