I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Introduction
The Label control is used to display the text that the user cannot edit. The label control exists within the System.Web.UI.WebControls namespace.
Public properties of the Label class
AssociatedControlID : Obtains or sets the identifier for a server control the Label control is associated with.
Text : Obtains or sets the text content of the Label control.
BackColor : Obtains or sets the back color of the Label.
Related Top Article
How to bind label control in asp.net
Example of Change label color dynamically
The Label control is used to display the text that the user cannot edit. The label control exists within the System.Web.UI.WebControls namespace.
Public properties of the Label class
AssociatedControlID : Obtains or sets the identifier for a server control the Label control is associated with.
Text : Obtains or sets the text content of the Label control.
BackColor : Obtains or sets the back color of the Label.
Related Top Article
How to bind label control in asp.net
Example of Change label color dynamically
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = " Welcome to dotprogramming.blogspot.com";
Label1.BackColor = System.Drawing.Color.Green;
Label1.ForeColor = System.Drawing.Color.Orange;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
Output
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = " Welcome to dotprogramming.blogspot.com";
Label1.BackColor = System.Drawing.Color.Green;
Label1.ForeColor = System.Drawing.Color.Orange;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
Comments
Post a Comment