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 }); }
In this article i will show you how to add image tag dynamically using JQuery. In this article i will show you how to add image tag using JQuery/JavaScript. First of all add a .JS script in the page. When we click on button then generate a jquery function. In this function, first to add a image tag with "$" sign. Also add image attribute with the image . Add dynamically created image in the division.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(function () {
$("#btnimg").click(function () {
var img = $('<img id="runtime">');
img.attr('src', "image/12.png");
img.appendTo("#div1");
});
});
</script>
</head>
<body>
<div id="div1">
</div>
<input type="button" id="btnimg" value="show image"/>
</body>
</html>
Code generate the following output:
Comments
Post a Comment