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 }); }
Custom control, the control with combined features of other controls, can be developed by any programmer easily. A custom control will not only be usable in the same application, but also it can be used in any other application that may be on other system. This designed control can be easily embedded in other applications.
Custom control have some basic features as well as some functionality that may be known by the programmer:
Inherited controls: developed by an existing .NET control that is as close as you want to develop. We have to create a custom class and inherit an existing abstract class that is close to what we are developing.
Owner-drawn controls: inherit from a base class like System.Windows.Forms.Control. These controls provides most customizable UI.
Extender providers: These are used to add features to other controls on a form, means these are not necessarily at all.
These controls may be used in our other applications and it reduces the amount of code and the code duplication. It also helps in modularize your code. In the next article we will explain about the steps to create a custom control and also about the events, need to override to create custom textbox.
Custom control have some basic features as well as some functionality that may be known by the programmer:
- Improves encapsulation.
- Simplifying a programming model.
- Can swap out a control with another one.
- Combines UI elements in a simple way.
- Using these controls programmer can develop unique controls.
Types
User Control: combines other controls in a logical unit. Inherit from System.Windows.Forms.UserControl class.Inherited controls: developed by an existing .NET control that is as close as you want to develop. We have to create a custom class and inherit an existing abstract class that is close to what we are developing.
Owner-drawn controls: inherit from a base class like System.Windows.Forms.Control. These controls provides most customizable UI.
Extender providers: These are used to add features to other controls on a form, means these are not necessarily at all.
These controls may be used in our other applications and it reduces the amount of code and the code duplication. It also helps in modularize your code. In the next article we will explain about the steps to create a custom control and also about the events, need to override to create custom textbox.
Comments
Post a Comment