Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
540
Multiline Cell Data
posted

Hello, I rarely get a response on these forums, but i'm at the end of the line here...

I have a "simple" problem.  I am currently using the web hierarchical data grid to display some schedule information.  Each row contains 0 to many assignments.  I simply want each assignment to be on a new line in the cell.

I was able to do this before by using the "<BR>" tag in the string that filled the cell, but that was with the UltraWebGrid and doesn't appear to be working in this one.  The entire grid is populated with an IEnumerable object and the properties within that object, no bands/columns are set in the .aspx page.  It seems like this should be really simple, but I can't figure out how to get the grid to recognize line breaks in the cells.  I also attempted to use Environment.NewLine, but that didn't work either.

Parents
No Data
Reply
  • 33839
    Suggested Answer
    posted

    Hi jasonwilczak,

    I apologize if you've previously had difficulty getting a response.  Efforts are being made to ensure all posts get answered by someone from Infragistics.
    As to your question here, it should be fairly simple to solve.  If you have defined your columns FormattedGridFields (in 11.1 and above) (which include BoundDataField and UnboundField) have a property called  EnableMultiLine.  This is false by default.  But when it is set to true, it will convert any '\n' characters in the string into <br> on the server before sending the html down.  Another option (and espically if you have 10.3 or below) would be to set HtmlEncode to false on the BoundDataField.  This will allow your <BR> that you have in the string to go down as an actual <BR> instead of being encoded to show that text.
    I do see that you have nothing in the aspx, so if you're adding your columns dynamically, simply set those properties.  If you're completely autogenerating, you'll need to access the column of a grid cell.  like grid.GridView.Rows[0].Items[0].Column.  Then typecase it and set the property.

    regards,
    David Young 

Children