I want to 'echo' a string separated by delimeters like: sergio|tapia|1999|10am
the Body of an HTML page.
How can I achieve this? Thank you!
I want to 'echo' a string separated by delimeters like: sergio|tapia|1999|10am
the Body of an HTML page.
How can I achieve this? Thank you!
Use
Response.Write(string)
.There are a couple of shortcuts to
Response.Write
if you are trying to output on the page:Or
See here for the different options.
In the new Razor syntax, you can just write @variable in your html and its value will be echoed:
You can use
Response.Write(str)
both in code-behind and on the .ASPX page:Using
Response.Write()
in code-behind places the string before the HTML of the page, so it's not always useful.You can also create a server control somewhere on your ASPX page, such as a label or literal, and set the text or value of that control in code-behind:
.ASPX:
Code-behind:
Outputs in HTML:
If you don't want
<span>
s added, use a literal:And set the value attribute of the literal instead of the text attribute: