Hello all, I am very very new to ASP.NET - just started looking into it a few days ago - and I got a book out to get the basics of APS.NET, Visual studio (which I haven't installed as yet) and C# (the book is ASP.NET 3.5 a beginners guide by William B Sanders). As I flicked through the first examples of code, I have noticed something and I am not sure whether it's me being silly, a mistake, or how things are. Let's have a look at a few of these examples.
1)this aspx file is part of a larger example to demonstrate variable types (which in this case, it is not my concern by the way):
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ConVar.aspx.cs"
Inherits="ConVar" %>
<!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 runat="server">
<title>Constants and Variables</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="YourAge" runat="server" Text="19" />
</div>
</form>
</body>
</html>
So, the asp tag seems to auto close but I swear I'd seen somewhere else that it has to be matched by an equivalent closing tag like </asp:Label>. Can anybody shed some light on this for me please?
2)Second one is far more interesting. Again it is part of a larger example to demonstrate basic comparison:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SimpleIf.aspx.cs"
Inherits="SimpleIf" %>
<!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 runat="server">
<title>Simple Conditional</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"/>
Number 1
<p/>
<asp:TextBox ID="TextBox2" runat="server"/>
Number 2
<p/>
<asp:Button ID="Compare" runat="server" Text="Compare" onclick="DoCompare" />
<p/>
</div>
</form>
</body>
</html>
Now, in this example there are </p> tags coming out of nowhere with no matching opening tag, and this left me rather puzzled: is it a mistake or is it the way things work in visual studio or ASP.NET?I trus tomebody can give me a hand to understand this
thanks