Example C # Of the htmltablerowcollection. getenumerator Method

Source: Internet
Author: User
The following code example demonstrates how to use the getenumerator method to create a system. Collections. ienumerator object. Then, access the system. Collections. ienumerator object cyclically to display the contents of the htmltablerowcollection.

View plaincopy to clipboardprint?
<% @ Page Language = "C #" autoeventwireup = "true" %>

<SCRIPT runat = "server">

Void button_click (Object sender, eventargs E)
{

Htmltablerow current_row;

// Create an ienumerator enumerator.
Ienumerator myenum = table1.rows. getenumerator ();

Span1.innertext = "the items in the rows of the table are :";

// Iterate through the ienumerator and display its contents.
While (myenum. movenext ())
{

Current_row = (htmltablerow) myenum. Current;
Span1.innertext = span1.innertext + "" + current_row.cells [0]. innertext +
"" + Current_row.cells [1]. innertext;

}

}

</SCRIPT>

<HTML>
<Head>




<Form runat = "server">

<H3> htmltablerowcollection example
<Table id = Table1 bordercolor = black border = 1 runat = "server"> <tbody> <tr> <TD> cell 1 </TD> <TD> Cell 2 </TD> </tr> <TD> cell 3 </TD> <TD> cell 4 </TD> </tr> </tbody> </table>

<Br>

<Input type = button value = "display row contents in the table" runat = "server" onserverclick = "button_click">

<Br>

<Span id = span1 runat = "server">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.