How to clone/duplicate a TableCell object

Discussion in 'ASP .Net' started by Chris Becker, Apr 1, 2004.

  1. Chris Becker

    Chris Becker Guest

    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
     
    Chris Becker, Apr 1, 2004
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.