Int, String and date variables (C#) : Type Convert « Language Basics « ASP.Net






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

1.Convert string to double (VB.net)
2.Convert int value to string (VB.net)
3.Convert selected date from asp:Calendar to long string (VB.net)
4.Convert value in asp:TextBox to int in try catch block (VB.net)
5.Convert value in asp:TextBox to date in try catch block (VB.net)
6.Convert value in asp:TextBox to bool in try catch block (VB.net)
7.Convert value from asp:TextBox to int and compare (VB.net)
8.Convert Now (current date) to string (C#)
9.Output ASCII Code (C#)
10.Convert String to int and decimal (C#)
11.Convert double and date to string (C#)
12.Read string from asp textbox and format it to DateTime (C#)
13.Convert int to String (C#)
14.Convert date to string (C#)