Results 1 to 2 of 2

Thread: cannot see dynamically created tables when app is run

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982

    cannot see dynamically created tables when app is run

    The following code is in my Page load event.
    I create a table, the label shows 5 so I know it is there.

    VB Code:
    1. If Not Page.IsPostBack Then
    2.     Dim i As Int16
    3.     Dim t As New Table
    4.  
    5.     For i = 1 To 5
    6.         Dim r As New TableRow
    7.         Dim c As New TableCell
    8.  
    9.         c.Text = "MainMenu" + i.ToString
    10.  
    11.         r.Cells.Add(c)
    12.         t.Rows.Add(r)
    13.     Next
    14.  
    15.     Label1.Text = t.Rows.Count.ToString
    16.     t.Visible = True
    17. End If

    Can anyone tell me why I cannot see it when I run the webapp


    Things I do when I am bored: DotNetable

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    although you have created the table in needs to be placed onto your page into a suitable container such as a placeholder.

    Simply add a placeholder to your aspx page
    VB Code:
    1. <asp:Placeholder id="phTest" runat=server>
    2. </asp:Placeholder>

    then after you build your table add the line
    VB Code:
    1. phtest.controls.add(t)
    Last edited by Fishcake; Mar 9th, 2004 at 08:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width