Table Control example

Source: Internet
Author: User
Protected void table_create ()
{
//------------------------------------------------------------------
Tablerow TR; // the row of the table defined
Tablecell TC; // Define table columns
Int trnum = 15; // number of rows
Int tcnum = 5; // Number of Columns
Literal lie1;
For (INT n = 0; n <trnum; n ++)
{
Tr = new tablerow ();
For (int v = 0; v <tcnum ;)
{
TC = new tablecell ();
Lie1 = new literal ();
TC. width = unit. pixel (50 );
Lie1.text = "row" + N + "column" + V;
TC. Controls. Add (lie1 );
// TC. Controls. Add (New literalcontrol ("row" + N + "column" + V ));
TC. horizontalalign = horizontalalign. Center;
If (V % 2 = 0)
{
TC. backcolor = color. hotpink;
}
Else
{
TC. backcolor = color. Green;
}
Tr. cells. Add (TC );
TC. Attributes. Add ("onclick", "alert ('nth" + N + "row" + ", Nth" + V + "column ');");
V ++;
}
Table2.rows. Add (TR );
If (N % 2 = 0)
{
Tr. Attributes. Add ("style", "page-break-after: Always; backcolor: back ;");
}
}

Table2.width = unit. pixel (560 );
Table2.borderwidth = unit. pixel (1 );
Table2.borderstyle = borderstyle. Ridge;
// Table2.attributes. Add ("onclick", "Return confirm ('continue testing? ');");
}

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.