search this blog [2700+ asp.net c# examples]

Loading...

Generate text in Page Load event in asp.net Label

Label Example: how to generate text in Page_Load event
Page_LoadLabelControl.aspx
<%@ Page Language="C#" %>

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

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e) {
        Label1.Text = "This text generated by Page_Load event";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Label Example: how to generate text in Page_Load event</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style=" color:Olive">Page_Load Event and Label</h2>
        <asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkOrange"></asp:Label>
    </div>
    </form>
</body>
</html>




Related asp.net example