private void BindList() { CatId = (int)Util.Val(Request.QueryString["catid"]); OrderBy = (int)Util.Val(Request.QueryString["ob"]); SortBy = (int)Util.Val(Request.QueryString["sb"]); //Get the current file path string ParamURL = Request.CurrentExecutionFilePath + "?&catid=" + CatId; int GetPage = (int)Util.Val(Request.QueryString["page"]); int iPage; if (string.IsNullOrEmpty(this.Request.QueryString["page"])) { iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page } else { iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value } //Initialize pagesize and pageindex int PageSize = pagerlinks.DefaultPageSize; int PageIndex = iPage; try { //Get category datasource object ArticleCategoryProvider GetCategory = new ArticleCategoryProvider(CatId, OrderBy, SortBy, PageIndex, PageSize); //Instantiate pager link object pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetCategory.RecordCount, PlaceHolder1); string artcatname; artcatname = GetCategory.Category; lbcatname.Text = GetCategory.Category; lbcount.Text = "(" + GetCategory.RecordCount.ToString() + ")"; //Display numeric pager link lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage); //Display the top right corner pager counter lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging; //Display the bottom pager counter lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging; ArticleCat.DataSource = GetCategory.GetCategories(); ArticleCat.DataBind(); //Release allocated memory GetCategory = null; Pager = null; } catch { } }
//Handles show edit article listing private void ShowEditArticleListing() { //Instantiate sql params object Blogic myBL = new Blogic(); //Instantiate validation Utility Util = new Utility(); int CatId; CatId = (int)Util.Val(Request.QueryString["catid"]); if (string.IsNullOrEmpty(this.Request.QueryString["catid"])) { Panel1.Visible = false; } else { Panel1.Visible = true; try { IDataReader dr = myBL.GetArticleCategory(CatId, 3); //3 = Category OrderBy Name. dr.Read(); lbcatname.Text = dr["CAT_NAME"].ToString(); dr.Close(); ArticleCat.DataSource = myBL.GetArticleCategory(CatId, 3); //3 = Category OrderBy Name. ArticleCat.DataBind(); } catch { Error.Text = "No Record Found."; return; } //Release allocated memory myBL = null; Util = null; } }
private void BindList() { CatId = (int)Util.Val(Request.QueryString["catid"]); strKeyword = Request.QueryString["find"].ToString(); OrderBy = (int)Util.Val(Request.QueryString["ob"]); SortBy = (int)Util.Val(Request.QueryString["sb"]); //Get the current file path string ParamURL = Request.CurrentExecutionFilePath + "?find=" + strKeyword + "&catid=" + CatId; int GetPage = (int)Util.Val(Request.QueryString["page"]); int iPage; if (string.IsNullOrEmpty(this.Request.QueryString["page"])) { iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page } else { iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value } //Initialize pagesize and page index int PageSize = pagerlinks.DefaultPageSize; int PageIndex = iPage; try { //Get category datasource object ArticleSearchProvider GetArticle = new ArticleSearchProvider(strKeyword, CatId, OrderBy, SortBy, PageIndex, PageSize); //Instantiate pager link object pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetArticle.RecordCount, PlaceHolder1); string strSearchIn; if (CatId == 0) { strSearchIn = "in all category."; } else { strSearchIn = "in <b>" + GetArticle.Category + "</b> category."; } //Get recipe count in category and assign it to the labale lbcount.Text = "(" + GetArticle.RecordCount.ToString() + ") recipes found for keyword (<b>" + strKeyword + "</b>) " + strSearchIn; //Display numeric pager link lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage); //Display the top right corner pager counter lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging; //Display the bottom pager counter lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging; //Bind Generic List to a repeater ArticleCat.DataSource = GetArticle.GetArticleSearchResult(); ArticleCat.DataBind(); //Release allocated memory GetArticle = null; Pager = null; } catch { lblNorecordFound.Visible = true; lblNorecordFound.Text = " No Article Found for the keyword (" + strKeyword + "). Please try again."; } }