Picture Gallery with paging
-
Hi. Can anyone give me an idea about it : I want to make a picture gallery using ASP.Net2 (C#), that images are in DB. I want using a control that has paging feature. but Gridview is not sufficeint, because it has borders. how can do it?
Best wishes
-
Hi. Can anyone give me an idea about it : I want to make a picture gallery using ASP.Net2 (C#), that images are in DB. I want using a control that has paging feature. but Gridview is not sufficeint, because it has borders. how can do it?
Best wishes
Hi.. use PagedDataSource class. Here an example that shows how to use an asp:Repeater with paging next and previus page
// After you get your data by using a DataAdapter fill a Dataset DataSet ds = new DataSet(); da.Fill(ds); // create an instance of PagedDataSource and give ds as datasource to it. PagedDataSource pds = new PagedDataSource(); pds.DataSource = ds; pds.AllowPaging = true; pds.PageSize = 10; // take curent page from QueryString and set CurrentPageIndex int CurPage; if (Request.QueryString["p"] != null) CurPage = Convert.ToInt32(Request.QueryString["p"]); else CurPage = 1; pds.CurrentPageIndex = CurPage-1; // bind pds to repeater and set link for next and prev links or you can simple make a loop and // write all page links down with using another repeater myRepeater.DataSource = pds; if (pds.Count > 0) { myRepeater.Visible = true; myRepeater.DataBind(); } if (!pds.IsFirstPage) lnkPrev.HRef = "news.aspx?p=" + Convert.ToString(CurPage - 1); if (!pds.IsLastPage) lnkNext.HRef = "news.aspx?p=" + Convert.ToString(CurPage + 1);
if it is not clear you could ask for more..karanba
-
Hi.. use PagedDataSource class. Here an example that shows how to use an asp:Repeater with paging next and previus page
// After you get your data by using a DataAdapter fill a Dataset DataSet ds = new DataSet(); da.Fill(ds); // create an instance of PagedDataSource and give ds as datasource to it. PagedDataSource pds = new PagedDataSource(); pds.DataSource = ds; pds.AllowPaging = true; pds.PageSize = 10; // take curent page from QueryString and set CurrentPageIndex int CurPage; if (Request.QueryString["p"] != null) CurPage = Convert.ToInt32(Request.QueryString["p"]); else CurPage = 1; pds.CurrentPageIndex = CurPage-1; // bind pds to repeater and set link for next and prev links or you can simple make a loop and // write all page links down with using another repeater myRepeater.DataSource = pds; if (pds.Count > 0) { myRepeater.Visible = true; myRepeater.DataBind(); } if (!pds.IsFirstPage) lnkPrev.HRef = "news.aspx?p=" + Convert.ToString(CurPage - 1); if (!pds.IsLastPage) lnkNext.HRef = "news.aspx?p=" + Convert.ToString(CurPage + 1);
if it is not clear you could ask for more..karanba
Hi karanba, I am not clear can you please send me a full code it is very urgent requirement. My mail id : briteindia_kumar@hotmail.com thanks and regards kumar