How to clone/duplicate a TableCell object


C

Chris Becker

I want to create a TableCell object once and add it to many tables:

Dim cell As New TableCell
cell.Style.Add("background-color", s)
cell.Style.Add("cursor", "pointer")
cell.Width = Unit.Pixel(CELLDIMENSION)
cell.Height = Unit.Pixel(CELLDIMENSION)
cell.HorizontalAlign = HorizontalAlign.Center
cell.Text = " "
cell.Attributes.Add("Title", s)
cell.Attributes.Add("onclick", "clk(this);")

Then I want to add that cell to TWO tables:

tblForegroundColors.Rows(tblForegroundColors.Rows.Count - 1).Cells.Add(cell)
tblBackgroundColors.Rows(tblBackgroundColors.Rows.Count - 1).Cells.Ad(cell)

The problem is, the cell is only added to the tblBackgroundColors table.
Some objects have a Clone() method that returns a duplicate object of the
current one. But TableCell does not.

How can I easily duplicate the cell object?

Thanks
Chris
 
Ad

Advertisements


Top