Word Wrap Possible ? Grid Control, Data Field

unackvi

New member
Joined
Feb 11, 2012
Messages
2
Programming Experience
1-3
Hi,
I have a Grid control whose columns get data dynamically by using Get command on
my UserDef table and into a DataTable. The Grid control's columns are also
defined in the VB code instead of the html/aspx.

One of the columns gets data from a multi-line text field and when displayed in the Grid, it goes
out of the grid column margins and does not fit on the page etc.

My Question:
Is it possible to apply any Word Wrap through my VB code and if yes, how? Would
I have to loop through every row and apply it to the data OR could I do it for
the column and it gets applied to the data once retrieved into the grid?

Appreciate any words of wisdom!
 
BoundField of GridView: Any formatting possible to the data?

Hi everyone,
I have a GridView whose columns get data dynamically. The GridView control's columns are also
defined in the VB code instead of the html/aspx.

Excerpts from the code
---------------------
aspx code:
<asp:GridView ID="grdContactDetails" runat="server" CssClass="bodyBlue"
BorderColor="Black" GridLines="Both" ShowFooter="False" AutoGenerateColumns="False"
width="570px" CellPadding="4" AllowSorting="False" AllowPaging="False">
</asp:GridView>

VB code:
Defining columns for the Grid:
Dim LogCommentCol As New BoundField
LogCommentCol.DataField = LogCommentsCol
LogCommentCol.HeaderText = "Comment"
LogCommentCol.Visible = True
Me.grdContactDetails.Columns.Add(LogCommentCol)

Retrieving Data:
Dim LogDT As DataTable

LogDT = GetLogDT()
Me.grdContactDetails.DataSource = LogDT
Me.grdContactDetails.DataBind()


Everything is working fine except the formatting for this Comments column. I have other Boundfields displaying data correctly.
Comments column gets data from a multi-line text field and when displayed in the Grid, if it was a really long comment, it goes
out of the grid column margins and does not fit on the page properly when printed.

My Question:
Is it possible to apply any formatting to break the line Or Word Wrap through my VB code and if yes, how?
Would I have to loop through every row and apply it to the data after it is retrieved OR could I do it for
the column using properties and it gets applied to the data after retrieved into the grid?
I don't even mind putting in some <BR> tags after X number of characters but I don't know where in the code.

Appreciate any words of wisdom!
 
Back
Top