Hvad har jeg gjort forkert?
<%@ Page Language="VB" %>
<script runat="server">
Sub Beregn_Click(sender As object, e As EventArgs)
If Page.IsValid Then
Dim d1 As DateTime = Convert.ToDateTime(dato1.Text)
Dim d2 As DateTime = Convert.ToDateTime(dato2.Text)
Dim antal as Double = d2.Subtract(d1).TotalDays
Resultat.Text = String.Format _
("Der er {0} dage mellem {1
} og {2
}", _
antal, d1, d2)
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:TextBox id="dato1" runat="server"></asp:TextBox>
<asp:RangeValidator id="RangeValidator1" style="Z-INDEX: 109; POSITION: absolute" runat="server" ErrorMessage="Forkert dato" Type="Date" MaximumValue="1-1-2900" MinimumValue="1-1-1900" ControlToValidate="dato1"></asp:RangeValidator>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" style="Z-INDEX: 108; POSITION: absolute" runat="server" ErrorMessage="Felt skal udfyldes" ControlToValidate="dato1" Display="Dynamic"></asp:RequiredFieldValidator>
</p>
<p>
<asp:TextBox id="dato2" runat="server"></asp:TextBox>
<asp:RangeValidator id="RangeValidator2" style="Z-INDEX: 107; POSITION: absolute" runat="server" ErrorMessage="Forkert dato" Type="Date" MaximumValue="1-1-2900" MinimumValue="1-1-1900" ControlToValidate="dato2"></asp:RangeValidator>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" style="Z-INDEX: 106; POSITION: absolute" runat="server" ErrorMessage="Felt skal udfyldes" ControlToValidate="dato2" Display="Dynamic"></asp:RequiredFieldValidator>
</p>
<p>
<asp
utton id="Beregn" runat="server" Text="Beregn"></asp
utton>
</p>
<p>
<asp:Label id="Resultat" runat="server"></asp:Label>
</p>
</form>
</body>
</html>