Hi,
I am using infragistics web ultrawebgrid of version 7.1 . I have binded a datasource to grid. All the columns
have string data. Now i want to wrap the cell data . When the data does not contain \r\n it should wrap. Even if
the data contains \r\n it is not wrapping.it always displays the data in single line.Please provide me the solution
as soon as possible
Replace "\r\n" in your strings with "<BR>". A web browser doesn't know that "\r\n" represents a "carriage-return line-feed" in .NET, but it knows that "<BR>" is meant to be a line break.
You may also need to set the grid's DisplayLayout.TableLayout to Auto, if it is currently set to Fixed. This will allow rows and columns to auto-size to their contents. Note that setting TableLayout to Auto also means that you need to turn off stationary margins and fixed headers, since these require TableLayout to be set to Fixed to work correctly.
Vince,
I have similar problem. actually on next step. My ultragrid correctly show line break in text using <br> tag.
eg "Client<br>Name" is shown in grid column as - ClientName
Problem arises when i export this grid to excel. Excel file shows this <BR> tag as it is-
Client<br>Name Any ideas? I am using ultrawebgrid v8.2 in asp.Vb.net Thanks in advanceDev
Dev,
The Excel Exporter will put the text of the WebGrid cell into the Excel cell. As far as the exporter is concerned, "<BR>" has no special meaning, so it's stored in the Excel file as plain text.
One solution is to use the RowExporting event of the UltraWebGridExcelExporter object, and modify the cells in e.GridRow to translate "<BR>" to the System.Environment.NewLine constant. In a typical scenario, since the page's response will be replaced by the Excel file you generate, it's safe to modify the cell values in this way, since they won't be persisted.
An alternative solution is to use the RowExported event of the UltraWebGridExcelExporter object instead. This time, you'd look through the Excel cells that were created, and replace any instances of "<BR>" with System.Environment.NewLine. This is a safer approach in all cases, since you're not modifying the grid's values directly at all, at the cost of being slightly less efficient for performance.
I have a similar problem. I cannot change the string since the column is bound to the database. I have no idea how to make the column wrap if there are no spaces in the string. I am using Infragistics 10.3 in ASP.Net 4.0.