Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > gridview: column width, wrap simplification?

Reply
Thread Tools

gridview: column width, wrap simplification?

 
 
Beemer Biker
Guest
Posts: n/a
 
      01-26-2009
I finally got a bound column in a gridview to be the size I wanted and for
the text to wrap correctly. This took a while with about 1/2 googling and
the other 1/2 guesswork. I was wondering if I did this correct or if there
was a better way (other than makeing a template).

I created "mytable { table-layout:fixed; }" css class and put it on the
gridview at its CssClass.

I set the ItemStyle width to 320px and Wrap to True for the column I wanted
to be 320px.

In the callback gridview1_RowCreated I set the cell width to 300px for that
column.
This gave an extra 20 pixels in the cell box after the text "wrapped".

Unless all of the above happened, I could not get it to resize at all.

It seems to me that all of this could have been avoided if I could bind the
text into the cell using some type of format string. ie: Where the column
has HtmlEncode, make it False; and for the DataFormatString, put in
something like "{0,120:}" where it would write out at most 120 characters
before wrapping. There probably isnt a format specifier like that.

I sure did see a lot of people asking how to vary the size of a gridview
column with many responding "that didnt work" when told to simply use
"ItemStyle-Width=320px" They were sure right.

sorry for the rant.

Anyway, it seem to be a real pain to set column width to arbitrary sizes
using VS2008 right out of the box.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To wrap or not to wrap? Aaron Fude Java 12 05-10-2008 06:33 PM
Wrap computer components in bubble wrap? Ickshka Computer Support 7 05-05-2006 05:54 PM
Wrap table column content Guru XML 1 10-02-2004 12:36 PM
Text::Wrap::wrap difference Art Werschulz Perl Misc 1 09-25-2003 06:15 PM
Text::Wrap::wrap difference Art Werschulz Perl Misc 0 09-22-2003 02:36 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57