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. Web Development
  3. ASP.NET
  4. Is there a way to add source-structured inputs dynamically to html through c#?

Is there a way to add source-structured inputs dynamically to html through c#?

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netquestion
3 Posts 3 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.
  • M Offline
    M Offline
    Member 3919049
    wrote on last edited by
    #1

    Is there a way to add source-structured inputs dynamically to html through c#? I'm adding inputs (HtmlGenericControls) dynamically to an ASP.NET. If I have 10 inputs I'd like to "view source" and see them neatly stacked on top of each other instead of rendered back-to-back in a big block. I've tried adding the following literal controls after each input in the loop but it doesn't seem to do anything: LiteralControl newLine = (new LiteralControl(((char)10).ToString())); LiteralControl carriageReturn = (new LiteralControl(((char)13).ToString())); Do you know if there's a way to do what I'm trying to do?

    N A 2 Replies Last reply
    0
    • M Member 3919049

      Is there a way to add source-structured inputs dynamically to html through c#? I'm adding inputs (HtmlGenericControls) dynamically to an ASP.NET. If I have 10 inputs I'd like to "view source" and see them neatly stacked on top of each other instead of rendered back-to-back in a big block. I've tried adding the following literal controls after each input in the loop but it doesn't seem to do anything: LiteralControl newLine = (new LiteralControl(((char)10).ToString())); LiteralControl carriageReturn = (new LiteralControl(((char)13).ToString())); Do you know if there's a way to do what I'm trying to do?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      What does it matter what the "view source" view looks like? How it is rendered is what is important.


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • M Member 3919049

        Is there a way to add source-structured inputs dynamically to html through c#? I'm adding inputs (HtmlGenericControls) dynamically to an ASP.NET. If I have 10 inputs I'd like to "view source" and see them neatly stacked on top of each other instead of rendered back-to-back in a big block. I've tried adding the following literal controls after each input in the loop but it doesn't seem to do anything: LiteralControl newLine = (new LiteralControl(((char)10).ToString())); LiteralControl carriageReturn = (new LiteralControl(((char)13).ToString())); Do you know if there's a way to do what I'm trying to do?

        A Offline
        A Offline
        Adam R Harris
        wrote on last edited by
        #3

        Well first of all i have to agree with Mark Nischalke, really how the HTML is formatted is irrelevant it only matters how the browser is rendering it. Having said that, I noticed in your code sample that you are creating the controls but not actually adding it to a place holder (which is how you should be dynamically adding controls to a web form) so maybe try adding your controls to a place holder and the HTML should render based on the order they were added to the place holder.

        If at first you don't succeed ... post it on The Code Project and Pray.

        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