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 }); }
Example of Generic Handlers
Step-1 : Add new "GenericHandlers.ashx" file in your project
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "html";
context.Response.Write("Hello World");
manaeform(context);
}
public void manaeform(HttpContext context)
{
context.Response.Write("<html><body><form>");
context.Response.Write("<h2>Select your feature</h2>");
if (context .Request .Params ["Feature"]==null)
{
context.Response.Write("<select name='Feature'>");
context.Response.Write("<option>asp.net </option>");
context.Response.Write("<option>java </option>");
context.Response.Write("</select></form></body></html>");
}
}
public bool IsReusable {
get {
return false;
}
}
}
OutputStep-1 : Add new "GenericHandlers.ashx" file in your project
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "html";
context.Response.Write("Hello World");
manaeform(context);
}
public void manaeform(HttpContext context)
{
context.Response.Write("<html><body><form>");
context.Response.Write("<h2>Select your feature</h2>");
if (context .Request .Params ["Feature"]==null)
{
context.Response.Write("<select name='Feature'>");
context.Response.Write("<option>asp.net </option>");
context.Response.Write("<option>java </option>");
context.Response.Write("</select></form></body></html>");
}
}
public bool IsReusable {
get {
return false;
}
}
}
Comments
Post a Comment