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 }); }
Array is a collection of similar item in programming language but is case of scripting language all variable treat as a variable type so we don't identify the type of it. In JQuery we have to create array at runtime, like
var array_name=[];
If you want to insert some item in it then use push(var item ) method.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(function(){
var array_name=[];
$('#Button1').click(function(){
var textbox_value=$('#Text1').val();
array_name.push(textbox_value);
for(var i=0;i<array_name.length;i++)
alert(array_name[i])
});
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter Your name:
<input id="Text1" type="text" value="Jacob" /><br />
<input id="Button1" type="button" value="button" />
</div>
</form>
</body>
</html>
When we click on button run JQuery function and insert item in the array.
var array_name=[];
If you want to insert some item in it then use push(var item ) method.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.10.2.js"></script>
<script>
$(function(){
var array_name=[];
$('#Button1').click(function(){
var textbox_value=$('#Text1').val();
array_name.push(textbox_value);
for(var i=0;i<array_name.length;i++)
alert(array_name[i])
});
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter Your name:
<input id="Text1" type="text" value="Jacob" /><br />
<input id="Button1" type="button" value="button" />
</div>
</form>
</body>
</html>
When we click on button run JQuery function and insert item in the array.
Comments
Post a Comment