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
Using AddSeconds method you can add seconds in integer, Object will be updated with new date and time. This method is used where you want to calculate time after some seconds. Like Library management project. Lets take an simple example<form id="form1" runat="server">
<asp:Button ID="Button1"
runat="server"
BackColor="#66CCFF"
onclick="Button1_Click" Text="Click" />
<div>
<asp:Label ID="Label1"
runat="server"
BackColor="Yellow"></asp:Label>
</div>
</form>
Code Behind
protected void Button1_Click(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
DateTime after56Seconds = now.AddSeconds(56);
Label1.Text = "present time = " + now.ToLongTimeString();
Label1.Text += "<br /><br />";
Label1.Text += "after added 56 seconds with present time= ";
Label1.Text += after56Seconds.ToLongTimeString();
}
Code Generate the following output
Comments
Post a Comment