protected void Page_Init(object sender, EventArgs e) { _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]); _Product = ProductDataSource.Load(_ProductId); HiddenProductId.Value = _ProductId.ToString(); if (_Product == null) { ProductCaption.Visible = false; } else { ProductCaption.Text = string.Format(ProductCaption.Text, _Product.Name); } if (!Page.IsPostBack) { //CHECK FOR SEARCH CACE SearchCache.SearchCriteria criteria = SearchCache.GetCriteria(); if ((criteria != null) && (criteria.Arguments.ContainsKey("ShowApproved"))) { ListItem item = ShowApproved.Items.FindByValue(criteria.Arguments["ShowApproved"].ToString()); if (item != null) { ShowApproved.SelectedIndex = ShowApproved.Items.IndexOf(item); } ReviewGrid.PageIndex = criteria.PageIndex; ReviewGrid.DefaultSortDirection = criteria.SortDirection; ReviewGrid.DefaultSortExpression = criteria.SortExpression; } } }
protected void ReviewGrid_DataBound(object sender, EventArgs e) { GridView grid = (GridView)sender; if (grid.Rows.Count > 0) { foreach (GridViewRow gvr in (grid.Rows)) { CheckBox cb = (CheckBox)gvr.FindControl("Selected"); ScriptManager.RegisterArrayDeclaration(grid, "CheckBoxIDs", String.Concat("'", cb.ClientID, "'")); } } else { ReviewActionPanel.Visible = false; } //CACHE THE SEARCH ARGUMENTS FOR NEXT VISIT SearchCache.SearchCriteria criteria = new SearchCache.SearchCriteria(); criteria.Arguments.Add("ShowApproved", ShowApproved.SelectedValue); criteria.PageIndex = grid.PageIndex; criteria.SortDirection = ReviewGrid.SortDirection; criteria.SortExpression = ReviewGrid.SortExpression; SearchCache.SetCriteria(criteria); }