Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word wrap in a grid

Status
Not open for further replies.

AEShier

IS-IT--Management
Apr 10, 2002
18
US
Hello. I have a grid in VI 6.0. I have a text field in the grid that contains notes, and I am trying to stop the data from wrapping. I turned off the wrap option on both the header and the data items, but it seems to have no effect. I would just like the data truncated in the display.

Any ideas?
 
"stop the data from wrapping"

do u use a text area or a text field?

if text area then dont use the word 'wrap' in the tag...

Known is handfull, Unknown is worldfull
 
If you actually do turn of wrapping it won't truncate the data. Do you know how HTML <table><tr><td> works? If not you will need this knowledge to finish this project.

If you do understand HTML tables then use the view source function in IE to see the HTML generated by the grid control. What you find will likely surprise you, it did me. Then you can modify the grid control .asp code to provide the changes you desire.


-pete
 
Well, I am familiar with the <table><tr><td> constructs. I looked at the html source that was being generated, and there really was nothing out of the ordinary that I could see. However, based on the fact that html source actually contains the hard-coded data values, I decided to just alter my record set to only return the first 40 characters of the field in question. It's not quite what I had in mind, but it works for now.

Thanks.
 
I guess what I was trying to get at with my original post is this: On the Format tab of the Grid Properties dialog, there is a check box labeled &quot;Wrap Text&quot;. This check box appears to have absolutely no affect on any of the data in the grid. It wraps, whether that box is checked or not.
 
The word wrap feature of the DTC is simply to state if you want the grig columns to have fixed width or dynamic width.
With fixed width (word wrap), the columns will have the width attribute added - the width as set in the designer at design time. In dynamic width, the table columns do not have the width attribute setting, so the browser re-sizes the columns to fit the data.
Of course, neither method is particularly good, and results vary between browsers. The only good way to fix a table column width is to have a sized image in the header column. Daft but true.

But you could always add a function to your grid column. So the database data becomes wrapped or modified in some way:

in the grid column put
=myFormatFunc([theDatabaseColumn])

now add a vbscript or javascript server-side function:

function myFormatFunc(sData)
... do somthing with sData
... - like truncate it to 40 characters
... or put it in a <SPAN> tag with a fixed width
myFormatFunc = &quot;<SPAN style=&quot;&quot;width=40&quot;&quot;>&quot; & sData & &quot;</SPAN>&quot;
end function

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top