Follow by Email

Thursday, 28 February 2013

How to change label color from code behind page in

Code Behind page:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class demoColor : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        this.Label1.BackColor = Color.Red;
        this.Label1.Text += "some text to output.";

.aspx Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="demoColor.aspx.cs" Inherits="demoColor" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<head runat="server">
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


Post a Comment

Design by Abhinav Ranjan Sinha