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