Solved

Limit datagrid field width and show contents of field

Posted on 2009-05-15
4
192 Views
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.
0
Comment
Question by:kdeutsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
ajolly earned 350 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)
    cellType.ToolTip=cellType.Text
    If cellType.Text.Length>30 then cellType.Text=cellType.Text.Substring(27)&"..."
End If
    
    

Open in new window

0
 

Author Comment

by:kdeutsch
ID: 24397963
Hi,
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.
0
 

Author Comment

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

Author Closing Comment

by:kdeutsch
ID: 31582012
Great solution
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

732 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