Solved

Limit datagrid field width and show contents of field

Posted on 2009-05-15
4
188 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

15 Experts available now in Live!

Get 1:1 Help Now