Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 665
  • Last Modified:

display only 50 character....in gridview

I have a filed calll "description" in gridview.

I would like to display only 50 character of "description" and replace the rest of characters with ' .....'.

How can I do this in ASP.net 2.0 C#?
0
jung1975
Asked:
jung1975
  • 2
  • 2
  • 2
1 Solution
 
kGeniusCommented:
  foreach (GridViewRow r in this.GridView1.Rows)
        {
            r.Cells[3].Text = r.Cells[3].Text.Substring(0, 50) + " ...";
        }

//where Cells[3] is your description field
//replace 3 by the column number (zero-based)
0
 
kGeniusCommented:
place it  in GridView_DataBound

kGenius
0
 
brianpsmith81Commented:
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
jung1975Author Commented:
but if I put a mouse over to the column , it should show the whole text? how can I do that? DO I have to use some kind of java script?
0
 
brianpsmith81Commented:
word of advice...don't award someone points and then ask another question under the same question...especially one that's arguably harder than the original.  There's no point in us answering with the motivation of points gone, especially for those that didn't receive any.  If you really need an answer, you should start a new question.  (Not trying to be a jerk, just giving a tip).
0
 
jung1975Author Commented:
got your point.. forgot to split the point..
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now