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
You can show System time as well as universal time through DateTime class. Now, this time you want to show only am and pm text after the current time. You can use "tt" in the ToString ( ) method. Lets create an simple algorithm.Step-1 : Take a web form into the project
Step-2 : Add two control (button and label control) onto the form window.
Step-3 : Raise button click event
Step-4 : Take single instance of DateTime class also pass "tt" parameter in ToString ( ) method.
Step-5 : Now Run your application from green triangle button or Ctrl+f5
Complete Source Code
<form id="form1" runat="server"><div>
<asp:Button ID="Button1"
runat="server"
onclick="Button1_Click"
Text="Click"
BackColor="#99CCFF" />
</div>
<asp:Label ID="Label1"
runat="server"
Text="Label"
BackColor="Yellow"></asp:Label>
</form>
Code Behind
protected void Button1_Click(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
Label1.Text = "current time PM AM: " + now.ToLongTimeString();
Label1.Text += "<br /><br />";
Label1.Text += "current time [PM AM]: " + now.ToString("tt");
}
Code generate the following output
AglocinYex_ba-Eugene Adam Leon Download
ReplyDeletevieducheasign