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. PHP echo equivalent???

PHP echo equivalent???

Scheduled Pinned Locked Moved ASP.NET
csharpphpasp-netquestion
2 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.
  • C Offline
    C Offline
    chathu03j
    wrote on last edited by
    #1

    HI, is there a ASP.NET equivalent for PHP's echo command? Or else is there a way to write on a web page without using a label or a textfield? Thanks for any reply!!

    G 1 Reply Last reply
    0
    • C chathu03j

      HI, is there a ASP.NET equivalent for PHP's echo command? Or else is there a way to write on a web page without using a label or a textfield? Thanks for any reply!!

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

      You can do like this: <%=someVariable%> However, if you use that your code quickly gets a mess of page level variables that you assign a vaule in one place and use in another place. You don't have to use a label or textfield to display values in the page, you can use any server control you like. A Literal control is useful if you want a control that does not add any html to what you put in it:

      <asp:Literal id="objInfo" />

      objInfo.Text = "Hello world!";

      This will put the text "Hello world!" in the page where the literal control was. There is no span tag added around the text. A PlaceHolder is useful for adding controls to the page:

      <asp:PlaceHolder id="objContainer" />

      objContainer.Controls.Add(new LiteralControl("Hello world!"));

      --- It's amazing to see how much work some people will go through just to avoid a little bit of work.

      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