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

  • SEARCH
  • Home
  • 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 263217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:34:59+00:00 2026-05-11T22:34:59+00:00

Here’s the problem: I have couple of pages which gets its content from a

  • 0

Here’s the problem:

I have couple of pages which gets its content from a database. The content is displayed in a Literal control kept on an asp.net page.

The article sometimes gets quite long so I want to break the content into two parts using a client script. Unfortunately I cannot change the query to pull data partially. The entire data has to come.

What I want is that when the page (http://mysite.com/showpage.aspx?pid=45) or any other page is opened, I show the first 500 words in that literal control. A Link gets generated below the 500 words which says ‘Click Here to View More…’

On clicking this link, a postback occurs and this time the entire content is shown to the user. I understand there is an extra roundtrip required but that’s ok for my users.

How can I create such a functionality? Please help me with the script. 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-11T22:35:00+00:00Added an answer on May 11, 2026 at 10:35 pm

    i use the following jQuery function to shorten a div of text and add a more button.

    http://www.reindel.com/truncate/

    Where, in the example below, 120 is the character limit.

    Character limit:
    An acceptable set of characters
    (designated by a regular expression)
    to truncate in front of, once the max
    has been reached. If an acceptable
    character is not found at the max, the
    plugin will traverse the string
    backwards until one is found. If none
    is found, the string will not
    truncate. The default value is a
    single white space character.

    $("#contentDiv").truncate( 120,{
            chars: /\s/,
            trail: [ " ( <a href='#' class='truncate_show'>more</a> . . . )", 
                     "( . . . <a href='#' class='truncate_hide'>less</a> )" ]
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my problem : I have a post controller with the action create.
Here is the problem that I am trying to solve. I have two folders
Here's a piece of code I copied from http://www.schillmania.com/content/projects/javascript-animation-1/demo/ Very simple JS animation: function
Here is the setup: dynamically generates content for a number of items which need
Here is my problem.. I have the option to create(add) two new input fields,
Here are the tables I have: Table A which has entries with item and
Here's the code I have. It works. The only problem is that the first
Here the scenario is I have many .aspx pages if any page gives error,
Here's a problem I ran into recently. I have attributes strings of the form
Here is the problem. I have <div id=main></div> I want to check user resolution

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.