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, water text of textBox using JQuery. i will give you an example of it. When first time browser load, all textbox generate a function, which are contains title of the textbox. Also add a class with all textboxes. Lets see the example of JQuery Watermark text:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
.text-based{
color:#808080;
font-weight:bold;
}
</style>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(document).ready(function () {
$('input[type="text"]').each(function () {
this.value = $(this).attr('title');
$(this).addClass('text-based');
$(this).focus(function () {
if (this.value == $(this).attr('title')) {
this.value = '';
$(this).removeClass('text-based');
}
});
$(this).blur(function () {
if (this.value == '') {
this.value = $(this).attr('title');
$(this).addClass('text-based');
}
})
})
});
</script>
</head>
<body>
UserName: <input type="text" value="" name="username" title="Enter UserName"/>
</body>
</html>
Code Generate the following output:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
.text-based{
color:#808080;
font-weight:bold;
}
</style>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(document).ready(function () {
$('input[type="text"]').each(function () {
this.value = $(this).attr('title');
$(this).addClass('text-based');
$(this).focus(function () {
if (this.value == $(this).attr('title')) {
this.value = '';
$(this).removeClass('text-based');
}
});
$(this).blur(function () {
if (this.value == '') {
this.value = $(this).attr('title');
$(this).addClass('text-based');
}
})
})
});
</script>
</head>
<body>
UserName: <input type="text" value="" name="username" title="Enter UserName"/>
</body>
</html>
Code Generate the following output:
Comments
Post a Comment