Use code behind to set value to asp:Literal (VB.net) : Literal « ASP.net Controls « ASP.NET Tutorial






<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="LiteralTime" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:literal runat="server" ID="currentTime"></asp:literal>
    </div>
    </form>
</body>
</html>


File: Default.aspx.vb


Partial Class LiteralTime
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        currentTime.Text = DateTime.Now
    End Sub
End Class








3.2.Literal
3.2.1.asp:Literal
3.2.2.Literal Control
3.2.3.The Mode property of Literal control
3.2.4.Use code behind to set value to asp:Literal (VB.net)