Limit datagrid field width and show contents of field

Posted on 2009-05-15
Medium Priority
Last Modified: 2012-05-07
I have a notes field in my datagrid control that gets quite big, what I would liek to do is limit teh width  of it so it does not go crazy adn tehn show the contents via a tool tip.  I believe taht I ccan access the tooltip via the e.item command, but how can i limit what is shown of the notes.
Question by:kdeutsch
  • 3

Accepted Solution

ajolly earned 1400 total points
ID: 24397842
Use 'ItemDataBound' event.
Write something like this:


If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
    Dim cellType As TableCell = e.Item.Cells(0)
    If cellType.Text.Length>30 then cellType.Text=cellType.Text.Substring(27)&"..."
End If

Open in new window


Author Comment

ID: 24397963
that works great, but how can I limit the size of the field in the datagrid itself, it still puts all the information in there and spreads it across the screen.

Author Comment

ID: 24398095
I figured it out, you limit witht he second variable.  got it.  Thanks for knowledge

Author Closing Comment

ID: 31582012
Great solution

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There is a wide range of advantages associated with the use of ASP.NET. This is why this programming framework is used to create excellent enterprise-class websites, technologies, and web applications.
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Did you know PowerShell can save you time with SaaS platforms? Simply leverage RESTfulAPIs to build your own PowerShell modules. These will kill repetitive tickets and tabs, using the command Invoke-RestMethod. Tune into this webinar to learn how…

621 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