获取或设置一个值,该值指示当到达单元格末尾时,由 HtmlTableCell 类的实例所表示的单元格中的文本是否自动继续在下一行显示。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.
public:
property bool NoWrap { bool get(); void set(bool value); };
public bool NoWrap { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.MinimizableAttributeTypeConverter))]
public bool NoWrap { get; set; }
member this.NoWrap : bool with get, set
[]
member this.NoWrap : bool with get, set
Public Property NoWrap As Boolean
属性值
如果在单元格中文本不自动换行,则为 true;否则,为 false。true if the text does not automatically wrap in the cell; otherwise, false. 默认值是 false。The default value is false.
示例
下面的代码示例演示如何使用属性以 NoWrap 编程方式控制文本是否换行到控件的单元格中 HtmlTable 。The following code example demonstrates how to use the NoWrap property to programmatically control whether the text wraps in the cells of an HtmlTable control.
/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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;
}
}
}
HtmlTableCell ExampleHtmlTableCell Example
style="border-width: 1; border-color: Black">
Here is some content for Cell 1.
Here is some content for Cell 2.
Here is some content for Cell 3.
Here is some content for Cell 4.
Select the display settings for the cells in the table:
Align:
runat="server">
Left
Center
Right
NoWrap:
runat="server">
True
False
VAlign:
runat="server">
Top
Middle
Bottom
value="Generate Table"
onserverclick="Button_Click"
runat="server"/>
/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Sub Button_Click(ByVal sender As Object, ByVal 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
HtmlTableCell ExampleHtmlTableCell Example
style="border-width: 1; border-color: Black">
Here is some content for Cell 1.
Here is some content for Cell 2.
Here is some content for Cell 3.
Here is some content for Cell 4.
Select the display settings for the cells in the table:
Align:
runat="server">
Left
Center
Right
NoWrap:
runat="server">
True
False
VAlign:
runat="server">
Top
Middle
Bottom
value="Generate Table"
onserverclick="Button_Click"
runat="server"/>
注解
使用 NoWrap 属性来指定或确定由类的实例表示的单元格中的文本在 HtmlTableCell 到达单元格末尾时是否自动在下一行上继续。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.
适用于
另请参阅