Int, String and date variables (C#)
<%@ Page Language="C#" Debug="true" %>
<script runat="server">
void Page_Load()
{
string CapitalCityOfUK;
int NumberOfStates;
DateTime IndependenceDay;
CapitalCityOfUK = "London";
NumberOfStates = 50;
IndependenceDay = Convert.ToDateTime("7/4/1776");
lblCapital.Text = CapitalCityOfUK;
lblNumStates.Text = Convert.ToString(NumberOfStates);
lblDateIndependence.Text = Convert.ToString(IndependenceDay);
}
</script>
<html>
<head>
<title>Creating Variables Example</title>
</head>
<body>
The contents of CapitalCityOfUk is: <asp:Label id="lblCapital" runat="server"></asp:Label>
<br />
The contents of NumberOfStates is: <asp:Label id="lblNumStates" runat="server"></asp:Label>
<br />
The contents of IndependenceDay is: <asp:Label id="lblDateIndependence" runat="server"></asp:Label>
</body>
</html>
Related examples in the same category