Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0GridView and pagingGridView and paging
Previous
 
Next
New Post
3/8/2007 9:35 PM
 

Does anybody have a good example of using the GridView in DNN with paging - I am using the DNN DAL+ and not sure what kind of structure supports paging 

Does this make any sense? (looking at this doc for my info http://msdn2.microsoft.com/en-us/library/5aw1xfh3.aspx)

 


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
3/8/2007 9:52 PM
 

I have this code:

PagedDataSource pagedData = new PagedDataSource();
pagedData.DataSource =
Controller.GetPicturesForEvent(this.PortalId, myUserID, myEventNumber);
pagedData.AllowPaging =
true;
pagedData.PageSize = 16;
pagedData.CurrentPageIndex = current_page - 1;
rptItems.DataSource = pagedData;
rptItems.DataBind();

"rptItems" is my DataList (or GridView or DataGrid) This is my DAL+ Method:

static public List<PictureInfo> GetPicturesForEvent(int portalID, int userID, string album_name)
        {
            StringBuilder mySqlString = new StringBuilder();
            mySqlString.Append("SELECT FotoVisionDNN_Pictures.PhotoID, FotoVisionDNN_Pictures.PhotoName, FotoVisionDNN_Pictures.Title, FotoVisionDNN_Pictures.Keywords, ");
            mySqlString.Append("FotoVisionDNN_Pictures.Date, FotoVisionDNN_Pictures.Description, FotoVisionDNN_Pictures.Hashcode ");
            mySqlString.Append("FROM FotoVisionDNN_Albums INNER JOIN ");
            mySqlString.Append("FotoVisionDNN_Pictures ON FotoVisionDNN_Albums.AlbumID = FotoVisionDNN_Pictures.AlbumID ");
            mySqlString.Append("WHERE (FotoVisionDNN_Albums.PortalID = @PortalID) AND (FotoVisionDNN_Albums.UserID = @UserID) AND (FotoVisionDNN_Albums.AlbumName = @AlbumName)");

            SqlParameter prmPortalID = new SqlParameter("@PortalID", SqlDbType.Int, 4);
            SqlParameter prmUserID = new SqlParameter("@UserID", SqlDbType.Int, 4);
            SqlParameter prmAlbumName = new SqlParameter("@AlbumName", SqlDbType.NVarChar, 100);
            prmPortalID.Value = portalID;
            prmUserID.Value = userID;
            prmAlbumName.Value = album_name;

            List<PictureInfo> pictureInfolist = new List<PictureInfo>();
            using (IDataReader dr = DotNetNuke.Data.DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), prmPortalID, prmUserID, prmAlbumName))
            {
                while (dr.Read())
                {
                    PictureInfo colPictureInfo = new PictureInfo();
                    colPictureInfo.PhotoID = Convert.ToInt32(dr["PhotoID"]);
                    colPictureInfo.PhotoName = String.Format(@"~/Portals/{0}/FotoVision/{1}/{2}/thumbnails/{3}", portalID, userID, album_name, Convert.ToString(dr["PhotoName"]));
                    colPictureInfo.Title = Convert.ToString(dr["Title"]);
                    colPictureInfo.Keywords = Convert.ToString(dr["Keywords"]);
                    colPictureInfo.PictureDate = Convert.ToDateTime(dr["Date"]);
                    colPictureInfo.Description = Convert.ToString(dr["Description"]);
                    colPictureInfo.Hashcode = Convert.ToString(dr["Hashcode"]);

                    pictureInfolist.Add(colPictureInfo);
                }
            }
            return pictureInfolist;
        }



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
3/9/2007 5:57 PM
 

Reading this gives me a question:

Anyone doing something similar to the above, but doing the paging within a stored procedure...rather then pulling down all-pages on each request and then sending the current page of data to the client?

 

 
New Post
3/9/2007 9:34 PM
 
sjstokes wrote

Anyone doing something similar to the above, but doing the paging within a stored procedure...rather then pulling down all-pages on each request and then sending the current page of data to the client?

 

This works great: Efficient Data Paging with the ASP.NET 2.0  I used it for a project and it can handle 100,000 records as easily as it can handle 20. The problem is it is overkill if you have less than a few hundred records. In my example I know I will only pull back 100 records at the most.

A thought I had, if you allow a person to page through thousands of records, even though you are only pulling the records you need, you're constantly hitting the database again and again. Of course there are situations where you need to do this, but usually I want less hits to my database so I want the user to narrow down their search as much as possible.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
3/11/2007 4:27 PM
 
Hello,
I wanted to post a new trend not until i saw this.
Am also having a problem with paging.
I could use GridView built-in feature to archive this, but when-ever the use hit back on the browser, the GridView Reset itself (Viewstate stuff) plus its not dynamic.
So I looked into the DNN web control, i found a paging control, which was even implemented for this forum module.
I dont have the source code(DNN), i would've seen the way it was done from the DAL/DAL+ to the controller class.
I need help on how to implement this paging control
thanks

chipset Arowolo
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0GridView and pagingGridView and paging


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out