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" >

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

void ButtonClick(Object sender, EventArgs e)

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



<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"/>


Run demo script




Visit LowPrices.co.uk for Your UK Shopping


Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk

Home / Site Map | Contact

All Content ©2020 WebRef.eu