HtmlTableCellCollection.Clear 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션에서 모든 HtmlTableCell 개체를 HtmlTableCellCollection 제거합니다.
public:
void Clear();
public void Clear();
member this.Clear : unit -> unit
Public Sub Clear ()
예제
다음 코드 예제에서는 컬렉션에서 모든 항목을 제거 하는 메서드를 사용 Clear 하는 방법을 보여 줍니다 HtmlTableCellCollection . 그런 다음 컬렉션에 새 항목이 추가되고 컨트롤에 HtmlTable 표시됩니다.
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Button_Click(Object sender, EventArgs e)
{
// Clear the cells from the first row and remove the
// row from the table.
Table1.Rows[0].Cells.Clear();
Table1.Rows.RemoveAt(0);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlTableCellCollection Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlTableCellCollection Example</h3>
<table id="Table1"
style="border-width:1; border-color:Black"
runat="server">
<tr>
<td>
Cell 1
</td>
<td>
Cell 2
</td>
</tr>
<tr>
<td>
Cell 3
</td>
<td>
Cell 4
</td>
</tr>
</table>
<br /><br />
<input type="button"
value="Remove First Row from Table"
onserverclick="Button_Click"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
' Clear the cells from the first row and remove the
' row from the table.
Table1.Rows(0).Cells.Clear()
Table1.Rows.RemoveAt(0)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlTableCellCollection Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlTableCellCollection Example</h3>
<table id="Table1"
style="border-width:1; border-color:Black"
runat="server">
<tr>
<td>
Cell 1
</td>
<td>
Cell 2
</td>
</tr>
<tr>
<td>
Cell 3
</td>
<td>
Cell 4
</td>
</tr>
</table>
<br /><br />
<input type="button"
value="Remove First Row from Table"
onserverclick="Button_Click"
runat="server"/>
</form>
</body>
</html>
설명
컬렉션에서 HtmlTableCellCollection 모든 HtmlTableCell 개체를 제거 하 고 속성을 다시 설정 하려면이 메서드를 0Count 사용 합니다.
메모
이 메서드는 행에서 셀을 제거하지만 표에서 행을 제거하지는 않습니다. 테이블에서 행을 제거하려면 컨트롤 컬렉션 HtmlTable 에서 Rows 행을 HtmlTableRow 나타내는 개체도 제거해야 합니다.