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#?
Who is Participating?
kGeniusConnect With a Mentor Commented:
place it  in GridView_DataBound

  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)
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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?
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).
jung1975Author Commented:
got your point.. forgot to split the point..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.