Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6753681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:11:29+00:00 2026-05-26T13:11:29+00:00

I have existing client code wherein sql data reader is being used to pull

  • 0

I have existing client code wherein sql data reader is being used to pull records from a database and in code behind, table content is being generated as string and then assigned to a asp:literal element on the page.

Dim myreader As SqlDataReader = selectcmd.ExecuteReader

If myreader.HasRows Then
str = str & "" // str is string

While myreader.Read()
If Not IsDBNull(myreader("column1")) Then
  str = str & "<tr><td align=left><font color=white>" & myreader("column1") & "</font></td></tr>"
End If
End While

// in the end string is assigned to Text attribute of asp:literal element

The client wants that pagination should be used, and that only 10 rows should be visible at a time and rest should be viewed via paging.

Can anyone suggest how this can be achieved.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:11:30+00:00Added an answer on May 26, 2026 at 1:11 pm

    Most of the time doing this sort of HTML concatenation on the server side is a very bad idea.

    For your scenario, you could possibly use a SQLDataSource to feed the data to a gridview and just enable support for paging & sorting. You wouldn’t have to write a single line of code to make it work, besides declaring your data source on the markup.

    There’s an excellent tutorial here.

    If that doesn’t cut it for you, you’ll have to implement paging yourself by asking the database to return exactly the number of rows you want based on the current page number. In general, you’ll need to use ROW_NUMBER() and TOP to page the results on the database side.

    Here’s an example on how to do paging on the database side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing InfoPath 2007 form that has some code-behind developed with VSTA.
I have used an open source code from CodeProject to read email from incoming
I have a jQuery autocomplete fild which gets existing data from my MVC action.
I'm working on a project where the client wants to have existing pages dynamically
For whatever reason, I have a lot of clients that have existing data that's
I have existing code that uses CMNewProfileSearch to find then iterate over the color
I have existing java code and need to create Design Document based on that.
I have quick question for you SQL gurus. I have existing tables without primary
I have an existing database with the table Transactions in it. I have added
I have some client side code that uploads an Outlook email to a document

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.