Skip to main content

Posts

Showing posts from May, 2018

Featured Post

How to use Tabs in ASP.NET CORE

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 });             }            

Implement TreeView in ASP.NET CORE

models  public class City     {         public int Id { get; set; }         public string Name { get; set; }         public int StateId { get; set; }         public virtual State State { get; set; }     }  public class State     {         public int Id { get; set; }         public string Title { get; set; }         public virtual List<City> City { get; set; }     }  public class TreeViewNode     {         public string id { get; set; }         public string parent { get; set; }         public string text { get; set; }     }  Controller Code  [HttpGet]  public IActionResult Index()         {             List<TreeViewNode> nodes = new List<TreeViewNode>();                      //Loop and add the Parent Nodes.             foreach (State type in _context.State)             {                 nodes.Add(new TreeViewNode { id = type.Id.ToString(), parent = "#", text = type.Title });             }             //Loop and add th