Hey guys,
I basically just started on ASP.NET. I'm following this tutorial, word for word, and for some reason can't get the result it wants.
It's suppose to be a form that'll postback on itself. But when I click submit, it doesn't do anything after. It returns a blank page.
The tutorial said to leave 'action="HelloThere"' out and even if i put it in, the same result. What could it be?
Thanks!
I basically just started on ASP.NET. I'm following this tutorial, word for word, and for some reason can't get the result it wants.
It's suppose to be a form that'll postback on itself. But when I click submit, it doesn't do anything after. It returns a blank page.
The tutorial said to leave 'action="HelloThere"' out and even if i put it in, the same result. What could it be?
Thanks!
Code:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] >
<head>
<title>Default Page</title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
NameForm.Visible = false;
NameLabel.Text = NameBox.Text;
NameLabel.Style.Add("font-weight", "bold");
}
TimeLabel.Text = DateTime.Now.ToString();
}
</script>
</head>
<body>
<form id="NameForm" runat="server">
<p>
Hello <asp:Label ID="NameLabel" runat="server">There!</asp:Label></p>
<p>
<asp:TextBox ID="NameBox" runat="server"></asp:TextBox>
<input type="submit" value="Submit" />
</p>
<div>
The time is now: <asp:Label ID="TimeLabel" runat="server" Text="Label"></asp:Label> </div>
</form>
</body>
</html>