Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How do I create dynamic content (has to be easy!)

How do I create dynamic content (has to be easy!)

Scheduled Pinned Locked Moved C#
csharpquestionc++htmlasp-net
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Roger Jane
    wrote on last edited by
    #1

    I’m missing something (I’m experienced with C, C++ but not with C#, ASP.NET)... I want to dynamically create a control/random HTML. Do I have to do it with, for example, HtmlTable table1 = new HtmlTable(); table1.Attributes.Add(“border”, “0”); table1.Attributes.Add(“align”, “center”); div1.controls.Add(table1); etc. or can I pass ‘<table border=”0” align=”center”>...</table>’ to something and have it render it? Rog -- modified at 14:41 Friday 20th January, 2006

    G 1 Reply Last reply
    0
    • R Roger Jane

      I’m missing something (I’m experienced with C, C++ but not with C#, ASP.NET)... I want to dynamically create a control/random HTML. Do I have to do it with, for example, HtmlTable table1 = new HtmlTable(); table1.Attributes.Add(“border”, “0”); table1.Attributes.Add(“align”, “center”); div1.controls.Add(table1); etc. or can I pass ‘<table border=”0” align=”center”>...</table>’ to something and have it render it? Rog -- modified at 14:41 Friday 20th January, 2006

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You don't have to render it if it's already html code. You put it on the page. Use for an example a placeholder: <asp:Placeholder id="Arthur" runat="server"/> Add a literal control containing the html code: Arthur.Controls.Add(new LiteralControl("<table ... > ... </table>")); --- b { font-weight: normal; }

      R 1 Reply Last reply
      0
      • G Guffa

        You don't have to render it if it's already html code. You put it on the page. Use for an example a placeholder: <asp:Placeholder id="Arthur" runat="server"/> Add a literal control containing the html code: Arthur.Controls.Add(new LiteralControl("<table ... > ... </table>")); --- b { font-weight: normal; }

        R Offline
        R Offline
        Roger Jane
        wrote on last edited by
        #3

        Excellent, thank you. I already have an 'Arthur' to hang things off. So, to do the dynamic bits, I can just adjust the string or use Arthur.FindControl("x") afterwards to adjust it. It's these things like not knowing about LiteralControl which are the 'things you don't know you don't know' that make forums like this so worthwhile! Thanks again. Rog

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups