Make Label text Bold, Italic and change bacground color programmatically in Asp .Net

 Write a program to change text of Label control to Bold, Italic and change its Background and Forecolor programmatically.

HTML

 
<%--//===== Label to show output.--%>


CodeBehind

protected void btnBold_Click(object sender, EventArgs e)
    {
        lblResult.Font.Bold = true;
    }
    protected void btnItalic_Click(object sender, EventArgs e)
    {
        lblResult.Font.Italic = true;
    }
    protected void btnBackGroundColor_Click(object sender, EventArgs e)
    {
        lblResult.BackColor = Color.Blue;
        lblResult.ForeColor = Color.White;
    }

Final Output

programmatically-make-text-bold-italic-backcolor-change-asp-net-practical-question-codingfusion

 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice