The echo command within PHP typically handles writing directly to the Response within an application or a web site. If you needed to actually handle this through code-behind, you could use something like the
Response.Write() method :
//Explicit Write
Response.Write("Write what you need here");
//Using a variable
var yourValue = 1;
Response.Write(yourValue);
If you just need to use it within a .cshtml page or within a View, you could simply wrap the value that you want to display within code-blocks (or if you are using the Razor View engine, prefix it with an '@') :
//Using the Traditional View Engine
<% Response.Write("Example"); %>
//Using Razor
@{ Response.Write("Example"); }
//Directly Writing
<%= "Example" %>
//Directly Writing using Razor
@("Example")
Member
2 Points
1 Post
php echo command equivalence of web pages in asp.net
Jun 17, 2013 12:30 PM|mauriciohz|LINK
Hello!
which is the equivalent of the PHP echo command in ASP.NET WEB PAGES?
Attentive to your suggestions,
Thank you,
regards
All-Star
114593 Points
18503 Posts
MVP
Re: php echo command equivalence of web pages in asp.net
Jun 17, 2013 12:40 PM|Rion Williams|LINK
The echo command within PHP typically handles writing directly to the Response within an application or a web site. If you needed to actually handle this through code-behind, you could use something like the Response.Write() method :
If you just need to use it within a .cshtml page or within a View, you could simply wrap the value that you want to display within code-blocks (or if you are using the Razor View engine, prefix it with an '@') :
Participant
1181 Points
405 Posts
Re: php echo command equivalence of web pages in asp.net
Jun 17, 2013 12:42 PM|mishra.bhupesh|LINK
There are many ways to show dynamic content
All-Star
194009 Points
28028 Posts
Moderator
Re: php echo command equivalence of web pages in asp.net
Jun 17, 2013 01:48 PM|Mikesdotnetting|LINK
You use the @ sign to render variables to the browser in Web Pages. See here for more help: http://www.mikesdotnetting.com/Article/153/Inline-Razor-Syntax-Overview