?
Solved

Attempting to create an infinite scroll app using jquery and asp.net

Posted on 2013-07-01
5
Medium Priority
?
376 Views
Last Modified: 2013-10-04
I am attempting to create an infinite scroll app using asp.net and jquery.  I would like it to be able to pull 10 records at a time.  I did in fact find a somewhat half done solution but it keeps repeating the same information from an xml source.  Does anybody have an idea on how I can do this as a commenting system similar to facebook?  This is the code that I found in the default.aspx.cs file.  How could I make it so that I am only pulling 10 records per postback?

     [WebMethod]
        public static string Foo()
        {
            StringBuilder getPostsText = new StringBuilder();
            using (DataSet ds = new DataSet())
            {
                ds.ReadXml(HttpContext.Current.Server.MapPath("App_Data/books.xml"));
                DataView dv = ds.Tables[0].DefaultView;

                foreach (DataRowView myDataRow in dv)
                {
                    getPostsText.AppendFormat("<p><b>author:</b> {0}</br>", myDataRow["author"]);
                    getPostsText.AppendFormat("genre: {0}</br>", myDataRow["genre"]);
                    getPostsText.AppendFormat("price: {0}</br>", myDataRow["price"]);
                    getPostsText.AppendFormat("publish date: {0}</br>", myDataRow["publish_date"]);
                    getPostsText.AppendFormat("description: {0}</br></p>", myDataRow["description"]);
                }
                getPostsText.AppendFormat("<div style='height:15px;'></div>");

            }
            return getPostsText.ToString();
        }
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 2000 total points
ID: 39300259
Hi,

You may have call the web method from jQuery! Many plugins available - http://www.infinite-scroll.com/infinite-scroll-jquery-plugin/

Hope it helps u...
0
 

Author Comment

by:VBBRett
ID: 39300340
Why do I get the feeling that every time I look into a JQuery, JavaScript or similar framework for help, the creator of the JQuery or JavaScript framework is short on instructions and doesn't follow through with examples of pulling data from databases?  The site is short on instructions.  I feel like every time I look for an example of somebody pulling data from a database, they always talk about stagnant content or loop through a for or while loop.  This is extremely frustrating!
0
 
LVL 23

Assisted Solution

by:Roopesh Reddy
Roopesh Reddy earned 2000 total points
ID: 39300386
0
 

Author Comment

by:VBBRett
ID: 39371716
Thank you roopeshreddy...I am currently reviewing the code that you sent me the link to.
0
 

Author Comment

by:VBBRett
ID: 39547398
Is it best to use a web service to do an example like this?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question