This should be done already for you. An ASP.NET GridView is rendered as an HTML table element.
I just tested the HTML table element and discovered that it automatically does "word wrapping" based on the cell width.
See for yourself by copying this into a text file and giving it an .html extension:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<style type="text/css">
-
td{
-
width:50px;
-
border:solid 1px black;
-
}
-
table{
-
border:solid 1px black;
-
}
-
</style>
-
</head>
-
<body>
-
<table id="myTable">
-
<tr>
-
<td>
-
This is some text. This is some text. This is some text.
-
</td>
-
<td>
-
This is some text. This is some text. This is some text.
-
</td>
-
</tr>
-
<tr>
-
<td>
-
This is some text. This is some text. This is some text.
-
</td>
-
<td>
-
This is some text. This is some text. This is some text.
-
</td>
-
</tr>
-
<tr>
-
<td>
-
This is some text. This is some text. This is some text.
-
</td>
-
<td>
-
This is some text. This is some text. This is some text.
-
</td>
-
</tr>
-
</table>
-
</body>
-
</html>
Now, you could try to use CSS to set the
overflow style for the cells (<td> elements) but when I tried this I didn't have any luck. I think that the overflow style only applies to block elements (and table cell elements are not block elements).
-Frinny