private void BindProduct() { StoreFront ObjService = new StoreFront(); DataSet DS = new DataSet(); DS = ObjService.GetProductSearch(Request.QueryString["Key"].ToString()); try { if (DS.Tables[0].Rows.Count > 0) { lblProdTitle.Text = "Fritzy's Pet Care Pros offer the following products :"; int currpage; PageDsProd.DataSource = DS.Tables[0].DefaultView; PageDsProd.AllowPaging = true; PageDsProd.PageSize = 10; if (ViewState["CurrentPage_Prod"] != null) { currpage = Convert.ToInt32(ViewState["CurrentPage_Prod"]); } else { currpage = 1; } ViewState["CurrentPage_Prod"] = currpage; PageDsProd.CurrentPageIndex = currpage - 1; bool check = false; if (PageDsProd.IsFirstPage) { check = true; lnkProdPrev.Visible = false; lnkProdNext.Visible = true; } else if (PageDsProd.IsLastPage) { check = true; lnkProdPrev.Visible = true; lnkProdNext.Visible = false; } if (PageDsProd.PageCount == 1) { lnkProdPrev.Visible = false; lnkProdNext.Visible = false; lnkProdPrev.CssClass = "linkDisable"; lnkProdNext.CssClass = "linkDisable"; } else if (PageDsProd.PageCount > 1 && check == false) { lnkProdPrev.Visible = true; lnkProdNext.Visible = true; } if (DS.Tables[0].Rows.Count == 0) { dlProducts.Visible = false; } else { Session["PDSAllProducts"] = PageDsProd; dlProducts.DataSource = PageDsProd; dlProducts.DataBind(); } if ((lnkProdPrev.Visible == true) && (lnkProdNext.Visible == true)) { lblProdLine.Visible = true; } else { lblProdLine.Visible = false; } } else { dlProducts.Visible = false; lnkProdPrev.Visible = false; lnkProdNext.Visible = false; lblProdLine.Visible = false; lblProdTitle.Text = "No record found."; } } catch { } }