I just want to greet the world... Where do I start?
-
I just want to make an "Hello World" for ASP.Net. A simple file that displays to the user "Hello World" in C#... With no overhead. In ASP regular, it was easy... I just did <% Response.Write "Hello World" %> What do I do in aspx??? I don't even know, exactly, how to tell it that I want to use C#. This is a bit overwhelming.
-
I just want to make an "Hello World" for ASP.Net. A simple file that displays to the user "Hello World" in C#... With no overhead. In ASP regular, it was easy... I just did <% Response.Write "Hello World" %> What do I do in aspx??? I don't even know, exactly, how to tell it that I want to use C#. This is a bit overwhelming.
<%@ Page language="c#" runat="server" %>
<script runat="server" language="c#">
void Page_Load()
{
labelHi.Text = "Hello World";
}
</script><html>
<head><title>Hello</title></head><body>
<asp:label id="labelHi" runat="server" />
</body>
</html>That should do the trick :) HTH, James Simplicity Rules!
-
<%@ Page language="c#" runat="server" %>
<script runat="server" language="c#">
void Page_Load()
{
labelHi.Text = "Hello World";
}
</script><html>
<head><title>Hello</title></head><body>
<asp:label id="labelHi" runat="server" />
</body>
</html>That should do the trick :) HTH, James Simplicity Rules!
Wait... This is how you do it? Forgive me, but that seems like a hack. Isn't there a simple way to do it? I'm looking for "response.write('hello world');"... Does everything have to be done with a control?
-
Wait... This is how you do it? Forgive me, but that seems like a hack. Isn't there a simple way to do it? I'm looking for "response.write('hello world');"... Does everything have to be done with a control?
It doesn't have to be, but that is the "ASP.NET way" of doing things. If you want to use Response.Write just throw in a script block in the body block doing so :) James Simplicity Rules!
-
<%@ Page language="c#" runat="server" %>
<script runat="server" language="c#">
void Page_Load()
{
labelHi.Text = "Hello World";
}
</script><html>
<head><title>Hello</title></head><body>
<asp:label id="labelHi" runat="server" />
</body>
</html>That should do the trick :) HTH, James Simplicity Rules!
If you make public member variable in your code-behind class it can be used as such:
class CodeBehind
{
public string mymessage = "Hello, World";other stuff
.
.
.<@ codebehind=...
<%=mymessage%>
-
I just want to make an "Hello World" for ASP.Net. A simple file that displays to the user "Hello World" in C#... With no overhead. In ASP regular, it was easy... I just did <% Response.Write "Hello World" %> What do I do in aspx??? I don't even know, exactly, how to tell it that I want to use C#. This is a bit overwhelming.
This should work:
<%@ Page language="c#">
<% Response.Write("Hello World."); %>-- David Wengier Sonork ID: 100.14177 - Ch00k