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
In this article i will show you how to fire event inside event using JQuery. I will give an example of it. In this article, first we create a table using JQuery then append the table with the dynamically created table. First, we get the column of the table for inside event then generate function on table row. Lets check the example.
Source code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="browserdetails.aspx.cs" Inherits="browserdetails" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<title></title>
<script>
$(function () {
$("#btncreate").click(function () {
var newtable = '<table id="mytable"><tr><td>Column1</td><td>Column2</td></tr><tr><td>Row11</td><td>Row12</td></tr></table>';
$("#tbcontainer").append(newtable);
var tblid = $("#tbcontainer table").attr("id");
$("#" + tblid).on("click", "tr:last", function () {
var val1 = $(this).find("td").eq(0).text();
var val2 = $(this).find("td").eq(1).text();
alert(val1 + " " + val2);
})
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<label id="tbcontainer" />
<input id="btncreate" type="button" value="button" />
</div>
</form>
</body>
</html>
Code Generate the following output
In this article i will show you how to fire event inside event using JQuery. I will give an example of it. In this article, first we create a table using JQuery then append the table with the dynamically created table. First, we get the column of the table for inside event then generate function on table row. Lets check the example.
Source code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="browserdetails.aspx.cs" Inherits="browserdetails" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<title></title>
<script>
$(function () {
$("#btncreate").click(function () {
var newtable = '<table id="mytable"><tr><td>Column1</td><td>Column2</td></tr><tr><td>Row11</td><td>Row12</td></tr></table>';
$("#tbcontainer").append(newtable);
var tblid = $("#tbcontainer table").attr("id");
$("#" + tblid).on("click", "tr:last", function () {
var val1 = $(this).find("td").eq(0).text();
var val2 = $(this).find("td").eq(1).text();
alert(val1 + " " + val2);
})
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<label id="tbcontainer" />
<input id="btncreate" type="button" value="button" />
</div>
</form>
</body>
</html>
Comments
Post a Comment