Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 19, 2010 12:03 AM by yuipcheng
Nov 10, 2010 11:48 PM|LINK
I commented out the code to truncate the FieldValueString, but the rendered text doesn't wrap since the td tag has style="white-space: nowrap;"
There is no code to set the wrap = false anywhere.
Why is this happening?
Nov 10, 2010 11:58 PM|LINK
i found a workaround by adding the following css code to List.aspx, but i rather get rid of the extra style code from the td tag.
Nov 11, 2010 01:16 AM|LINK
Hi Yuipcheng, it would appear that DD is adding this and I can't find a way around it yet [:(]
Dynamic Data 4
Nov 14, 2010 10:27 AM|LINK
Hi Yuipcheng, David Fowler gave me the solution, which is to create a class based on the DefaultAutoFieldGenerator and override the CreateField method:
/// Add the option to the Default Auto Field Generator
/// to not add the (Style="white-space: nowrap;") to each field.
public class AdvancedAutoFieldGenerator : DefaultAutoFieldGenerator
private Boolean _noWrap;
/// Initializes a new instance of the
/// <see cref="AdvancedAutoFieldGenerator"/> class.
/// <param name="table">The table.</param>
/// <param name="noWrap">if set to <c>true</c>
/// the (Style="white-space: nowrap;") is added
/// to each field.</param>
public AdvancedAutoFieldGenerator(MetaTable table, Boolean noWrap)
_noWrap = noWrap;
protected override DynamicField CreateField(
DynamicField field = base.CreateField(column, containerType, mode);
field.ItemStyle.Wrap = !_noWrap;
In the CreateFiedl method we call the base and then set the field.ItemStyle.Wrap value to turn off the nowrap feature.
I decided that I wanted to be able to turn this off or leave it on so I added a parameter to the contstuctor for this.
We use this on the List page in the Page_Load event (if we do it6 any earlier then the DefaultAutoFieldGenerator will still be applied instead) like this:
// apply custom auto field generator
GridView1.ColumnsGenerator = new AdvancedAutoFieldGenerator(table, false);
setting the noWrap parameter to false will turn off the feature wich adds the style="white-space:nowrap;" to each table cell and row.
Hope this helps [:)]
Dynamic Data 4
Nov 19, 2010 12:03 AM|LINK