Solved

display only 50 character....in gridview

Posted on 2006-06-21
6
613 Views
Last Modified: 2012-05-05
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
Comment
Question by:jung1975
  • 2
  • 2
  • 2
6 Comments
 
LVL 7

Expert Comment

by:kGenius
ID: 16954941
  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
 
LVL 7

Accepted Solution

by:
kGenius earned 250 total points
ID: 16954946
place it  in GridView_DataBound

kGenius
0
 
LVL 3

Expert Comment

by:brianpsmith81
ID: 16954954
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:jung1975
ID: 16955042
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
 
LVL 3

Expert Comment

by:brianpsmith81
ID: 16955192
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
 

Author Comment

by:jung1975
ID: 16955477
got your point.. forgot to split the point..
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now