Designing Table Programmatically

Discussion in 'ASP .Net' started by =?Utf-8?B?RGF2aWQgVGlsbWFu?=, Jul 25, 2005.

  1. I need to create some tables on a web page at run time rather than design
    time. There could be 1 - 5 tables on the page depending on options. I've
    created the tables by creating the cells, rows, and tables just as I want
    them, but I don't know how to get them to render. Is there a function to add
    the html code for the tables to the aspx file during run time? What is the
    best way to handle this. Any examples I find to creating tables
    programmatically has the programmer manually add the html code to the aspx
    file during design time rather than creating them dynamically for a different
    number of controls.
    =?Utf-8?B?RGF2aWQgVGlsbWFu?=, Jul 25, 2005
    #1
    1. Advertising

  2. You just create HtmlTable Controls and add them to the Controls Collection
    of the WebForm.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    The sun never sets on
    the Kingdom of Heaven

    "David Tilman" <> wrote in message
    news:D...
    >I need to create some tables on a web page at run time rather than design
    > time. There could be 1 - 5 tables on the page depending on options. I've
    > created the tables by creating the cells, rows, and tables just as I want
    > them, but I don't know how to get them to render. Is there a function to
    > add
    > the html code for the tables to the aspx file during run time? What is the
    > best way to handle this. Any examples I find to creating tables
    > programmatically has the programmer manually add the html code to the aspx
    > file during design time rather than creating them dynamically for a
    > different
    > number of controls.
    Kevin Spencer, Jul 25, 2005
    #2
    1. Advertising

  3. You add them to the Controls property for some parent element. When you say
    that you created the cells and rows, do you mean actual TableCell and
    TableRow objects?

    1) Add some container to your HTML like a DIV. Something that you can
    reference in code.
    2) Mark this as "runat=server".
    3) Add the Table object to the Controls property for the DIV. The table
    should then render.


    "David Tilman" <> wrote in message
    news:D...
    > I need to create some tables on a web page at run time rather than design
    > time. There could be 1 - 5 tables on the page depending on options. I've
    > created the tables by creating the cells, rows, and tables just as I want
    > them, but I don't know how to get them to render. Is there a function to

    add
    > the html code for the tables to the aspx file during run time? What is the
    > best way to handle this. Any examples I find to creating tables
    > programmatically has the programmer manually add the html code to the aspx
    > file during design time rather than creating them dynamically for a

    different
    > number of controls.
    Peter Rilling, Jul 25, 2005
    #3
  4. Use HTMLtextwriter to render and write this in the render event.
    Or
    Drop placeholder object in the aspx page ...and add controls to it whatever
    u have created dynamically
    Or
    Add controls to Form itself but here u can place it exactly in the way u
    need it.

    "Kevin Spencer" wrote:

    > You just create HtmlTable Controls and add them to the Controls Collection
    > of the WebForm.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > ..Net Developer
    > The sun never sets on
    > the Kingdom of Heaven
    >
    > "David Tilman" <> wrote in message
    > news:D...
    > >I need to create some tables on a web page at run time rather than design
    > > time. There could be 1 - 5 tables on the page depending on options. I've
    > > created the tables by creating the cells, rows, and tables just as I want
    > > them, but I don't know how to get them to render. Is there a function to
    > > add
    > > the html code for the tables to the aspx file during run time? What is the
    > > best way to handle this. Any examples I find to creating tables
    > > programmatically has the programmer manually add the html code to the aspx
    > > file during design time rather than creating them dynamically for a
    > > different
    > > number of controls.

    >
    >
    >
    =?Utf-8?B?SEFSSSBQUkFTRCBCQVJV?=, Jul 25, 2005
    #4
  5. =?Utf-8?B?RGF2aWQgVGlsbWFu?=

    Charlie@NISH Guest

    You can send HTML markup to browser using
    Response.Write("HTMLstringthatbuildstables")

    Charlie
    "David Tilman" <> wrote in message
    news:D...
    >I need to create some tables on a web page at run time rather than design
    > time. There could be 1 - 5 tables on the page depending on options. I've
    > created the tables by creating the cells, rows, and tables just as I want
    > them, but I don't know how to get them to render. Is there a function to
    > add
    > the html code for the tables to the aspx file during run time? What is the
    > best way to handle this. Any examples I find to creating tables
    > programmatically has the programmer manually add the html code to the aspx
    > file during design time rather than creating them dynamically for a
    > different
    > number of controls.
    Charlie@NISH, Aug 12, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,107
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. sam
    Replies:
    2
    Views:
    1,571
    Bobby Ryzhy
    Jul 8, 2004
  3. Rio
    Replies:
    4
    Views:
    1,174
  4. Guest
    Replies:
    0
    Views:
    504
    Guest
    Jun 24, 2007
  5. ma
    Replies:
    7
    Views:
    676
    Alexey Smirnov
    Aug 27, 2007
Loading...

Share This Page