ASP.Net C# How to display messages?

We are learning Asp.Net with Visual Studio 2013 and C#.
One thing we havent been able to do is to display a message in an Asp.Net C# page (.aspx.cs)

In php we used to use "echo" with an 'exit', or an 'alert' in Javascript.

How can we achieve this in an .Net page?
LVL 2
José PerezAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
How are you wanting to display this message?  Something as simple as:

Default.aspx -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EE_Q28640789._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title></title>
</head>
<body>
	<form id="form1" runat="server">
		<div>
			<asp:Literal ID="Literal1" runat="server"></asp:Literal>
		</div>
	</form>
</body>
</html>

Open in new window

Default.aspx.cs -
using System;

namespace EE_Q28640789
{
	public partial class _Default : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			Literal1.Text = "Hello World from ASP.NET";
		}
	}
}

Open in new window

Produces the following output -Capture.JPG-saige-

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lokesh B RDeveloperCommented:
protected void Page_Load(object sender, EventArgs e)
{
         Response.Write("Hello World..!!!");
}

Or Add a Label

protected void Page_Load(object sender, EventArgs e)
{
          Label1.Text = "Hello World...!!!";
}
José PerezAuthor Commented:
@Lokesh_B_R
We have tried  your first choice, the one we like the most, but it is not working:

{
         Response.Write("Hello World..!!!");
}

Open in new window


It displays nothing :( Is there something we can do to make it work?
José PerezAuthor Commented:
Finally, literal was the better approach.
Thanks all.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.