HtmlTableCell.NoWrap Property
Gets or sets a value indicating whether the text in a cell represented by an instance of the HtmlTableCell class automatically continues on the next line when it reaches the end of the cell.
[Visual Basic] Public Property NoWrap As Boolean [C#] public bool NoWrap {get; set;} [C++] public: __property bool get_NoWrap(); public: __property void set_NoWrap(bool); [JScript] public function get NoWrap() : Boolean; public function set NoWrap(Boolean);
Property Value
true if the text does not automatically wrap in the cell; otherwise, false. The default value is false.
Remarks
Use the NoWrap property to specify or determine whether the text in a cell represented by an instance of the HtmlTableCell class automatically continues on the next line when it reaches the end of the cell.
Example
[Visual Basic, C#] The following example demonstrates how to use the NoWrap property to programmatically control whether the text wraps in the cells of an HtmlTable control.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub Button_Click(sender As Object, e As EventArgs) Dim i As Integer Dim j As Integer ' Iterate through the rows of the table. For i = 0 to Table1.Rows.Count - 1 ' Iterate through the cells of a row. For j = 0 To Table1.Rows(i).Cells.Count - 1 ' Update the properties of each cell. Table1.Rows(i).Cells(j).Align = AlignSelect.Value Table1.Rows(i).Cells(j).NoWrap = Convert.ToBoolean(NoWrapSelect.Value) Table1.Rows(i).Cells(j).VAlign = VAlignSelect.Value Next j Next i End Sub </script> </head> <body> <form runat="server"> <h3>HtmlTableCell Example</h3> <table id="Table1" Border="1" BorderColor="black" runat="server"> <tr> <td> Here's some content for Cell 1. </td> <td> Here's some content for Cell 2. </td> </tr> <tr> <td Width="100" Height="100"> Here's some content for Cell 3. </td> <td Width="100" Height="100"> Here's some content for Cell 4. </td> </tr> </table> <hr> Select the display settings for the cells in the table: <br><br> Align: <select id="AlignSelect" runat="server"> <option Value="Left" Selected="True">Left</option> <option Value="Center">Center</option> <option Value="Right">Right</option> </select> NoWrap: <select id="NoWrapSelect" runat="server"> <option Value="true">True</option> <option Value="false" Selected="True">False</option> </select> VAlign: <select id="VAlignSelect" runat="server"> <option Value="Top">Top</option> <option Value="Middle" Selected="True">Middle</option> <option Value="Bottom">Bottom</option> </select> <br><br> <input type="button" value="Generate Table" OnServerClick = "Button_Click" runat="server"/> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void Button_Click(Object sender, EventArgs e) { // Iterate through the rows of the table. for (int i=0; i<=Table1.Rows.Count - 1; i++) { // Iterate through the cells of a row. for (int j=0; j<=Table1.Rows[i].Cells.Count - 1; j++) { // Update the properties of each cell. Table1.Rows[i].Cells[j].Align = AlignSelect.Value; Table1.Rows[i].Cells[j].NoWrap = Convert.ToBoolean(NoWrapSelect.Value); Table1.Rows[i].Cells[j].VAlign = VAlignSelect.Value; } } } </script> </head> <body> <form runat="server"> <h3>HtmlTableCell Example</h3> <table id="Table1" Border="1" BorderColor="black" runat="server"> <tr> <td> Here's some content for Cell 1. </td> <td> Here's some content for Cell 2. </td> </tr> <tr> <td Width="100" Height="100"> Here's some content for Cell 3. </td> <td Width="100" Height="100"> Here's some content for Cell 4. </td> </tr> </table> <hr> Select the display settings for the cells in the table: <br><br> Align: <select id="AlignSelect" runat="server"> <option Value="Left" Selected="True">Left</option> <option Value="Center">Center</option> <option Value="Right">Right</option> </select> NoWrap: <select id="NoWrapSelect" runat="server"> <option Value="true">True</option> <option Value="false" Selected="True">False</option> </select> VAlign: <select id="VAlignSelect" runat="server"> <option Value="Top">Top</option> <option Value="Middle" Selected="True">Middle</option> <option Value="Bottom">Bottom</option> </select> <br><br> <input type="button" value="Generate Table" OnServerClick = "Button_Click" runat="server"/> </form> </body> </html>
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
HtmlTableCell Class | HtmlTableCell Members | System.Web.UI.HtmlControls Namespace | Align | ColSpan | RowSpan | VAlign