WebRef.eu  - Internet Marketing and Online Business Resources  

Home / Site Map | Contact

 

C# Literal Control

To show C# output on a web page, you can set the Text property of a Literal or Label control. This example uses a Literal control. The Label control is similar but it can also be styled.

<%@ Page Language="C#" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
<title>Literal Example</title>
<script runat="server">

void ButtonClick(Object sender, EventArgs e)

{
   Literal1.Text="Welcome to ASP.NET!!";
}

</script>
</head>

<body>

<form id="form1" runat="server">

<h3>Literal Example</h3>

<asp:Literal id="Literal1" Text="Hello World!!" runat="server"/>
<br /><br />

<asp:Button id="Button1" Text="Change Literal Text" OnClick="ButtonClick" runat="server"/>

</form>
</body>
</html>

Run demo script

References

https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.literal?view=netframework-4.8

 



Visit LowPrices.co.uk for Your UK Shopping



Buy the Samsung Galaxy S25 Ultra from Three

Buy the Samsung Galaxy S25 Ultra from Three:
- Powerful octa-core processor for snappy performance.
- Galaxy AI Assistant helps you get things done quickly.
- Pro-level photography in your pocket

 




Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk


Home / Site Map | Contact

All Content ©2020 WebRef.eu