Use code behind to set value to asp:Literal

Saranya Boopathi
Posted by Saranya Boopathi under VB.NET category on | Points: 40 | Views : 1533
<%@ 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

Comments or Responses

Login to post response