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 }); }
Html.RadioButton() handler, used to return radio button input element to be input true or false value by user. Checked radio button will return true and un-checked will return false, otherwise it returns null to store/use the value.
Html.RadioButton() handler method is used to present mutually exclusive option i.e. true of false. Using this radiobutton method makes it easy to bind to view data or model is so easy in compare to using simple input radio element. This handler provides mostly same features as Html.CheckBox() handler discussed earlier.
Parameters
e.g Html.RadioButtonFor(model=>model.Gender)
Render radio button input for the property gender passed via controller. Submitting form will assign the value of this radio button to model’s gender property to be accessed in the controller’s action.
Html.RadioButton() handler method is used to present mutually exclusive option i.e. true of false. Using this radiobutton method makes it easy to bind to view data or model is so easy in compare to using simple input radio element. This handler provides mostly same features as Html.CheckBox() handler discussed earlier.
Parameters
- htmlHelper: specify html helper instance that this method extends.
- name: specify name of input element used to access the value in controller.
- value: specify value of radio button element. If none is assigned then this attribute is used to access the value.
- isChecked: to be set true of false for radio button. True to select the element, OW false.
- htmlAttributes: specify an object that contains html attributes to set for the element.
e.g Html.RadioButton(“gender”)
Html.RadioButtonFor(…)
Having the same functionality as Html.RadioButton() but it returns radio button element for each property passed via the model from controller’s action. This handler have two types of type parameters i.e. TModel (specify type of model) and TProperty (specify type of value).Parameters
- htmlHelper: specify html helper instance that this method extends.
- expression: used to identifies object containing the property to render.
- value: specify value of radio button element. If none is assigned then this attribute is used to access the value.
- htmlAttributes: specify an object that contains html attributes to set for the element.
e.g Html.RadioButtonFor(model=>model.Gender)
Render radio button input for the property gender passed via controller. Submitting form will assign the value of this radio button to model’s gender property to be accessed in the controller’s action.
Comments
Post a Comment