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 }); }
The HtmlImage class
The HtmlImage Class creates an HTML <img> element,
which is used to display images on the web page. Using the properties of this
class, you can change the image size and the image displayed as well as the
alignment of the image with respect to other HTML elements. The HTML Image
class gives you access to the HTML,<img> elements in server code.
Public Properties of the HtmlImage Class
Property
|
Description
|
Align
|
Obtains or sets the image’s alignment with respect to other HTML
elements.
|
Alt
|
Obtains or sets the alternative text to display if an image cannot be
displayed.
|
Border
|
Obtains or sets the width of the image’s border
|
Height
|
Obtains or sets the image’s height
|
Src
|
Obtains or sets the URL of the image
|
Width
|
Obtains or sets the image’s width
|
Lets take an Simple example
<%@ 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 server_click(Object sender, EventArgs e)
{
first.InnerHtml = "Welcome Message";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Access Html Image in Code page<br />
<input type="image" runat ="server" src ="submit.jpg" id="image1" onserverclick ="server_click" />
<div id="first" runat ="server">
</div>
<br />
</div>
</form>
</body>
</html>
<!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 server_click(Object sender, EventArgs e)
{
first.InnerHtml = "Welcome Message";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Access Html Image in Code page<br />
<input type="image" runat ="server" src ="submit.jpg" id="image1" onserverclick ="server_click" />
<div id="first" runat ="server">
</div>
<br />
</div>
</form>
</body>
</html>
Output
Comments
Post a Comment