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 }); }
User profile
A user profile is a collection of various properties that
describes the information you want to store for a specific user. You can store
the properties associated with a user in a user profile. The data that is
stored in a profile can be accessed programmatically.
The profile feature in ASP.NET allows you to define and store user-specific
settings. In addition, a website can be more user friendly if it is customized
according to the preferences of a user. For example, a shopping website
displays the shopping cart that consists of the items that are frequently
purchased by the user. To Induce such functionality, a website needs to
retrieve and load the user’s data when the request for a Web page is made for
the first time. After the request is completed, the current settings, such as
the address and phone number of a user, must be stored on the server. Consequently,
when the same user request for the same
Web page, the respective settings stored on the server corresponding to a user
are retrieved.
The user’s profile is defined in the machine.config or web.config file . The following Syntax of
the web.config file contains the description of a user profile.
<profile>
<properties >
<add name="Address" type ="string"/>
<add name ="phone" type ="integer"/>
</properties>
</profile>
The preceding syntax defines a profile
by using properties in the web.config file. The <add> element defines the
properties of a profile. The properties of a user profile consists of both
simple data type and complex data types.
Lets take an Simple Example
Web.config file code
<system.web>
<anonymousIdentification enabled ="true"/>
<profile>
<properties >
<add name="name" type ="string" allowAnonymous ="true"/>
<add name ="DOB" type ="dateofbirth" allowAnonymous ="true"/>
</properties>
</profile>
<authentication mode="Forms" />
<compilation debug="false" targetFramework="4.0" />
</system.web>
Class File Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for dateofbirth
/// </summary>
public class dateofbirth
{ private string day;
private string month;
private string year;
public string Day
{
get
{
return day;
}
set
{
day = value;
}
}
public string Month
{
get
{
return month;
}
set
{
month = value;
}
}
public string Year
{
get
{
return year;
}
set
{
year = value;
}
}
public dateofbirth()
{
}
}
Source code
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Profile .name =TextBox1 .Text ;
Profile .DOB.Day=TextBox2 .Text ;
Profile .DOB.Month =TextBox3 .Text ;
Profile.DOB.Year = TextBox4.Text;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>Your DateOfBirth is
<%= Profile.DOB .Day %>/
<%= Profile .DOB .Month %>/<%= Profile .DOB .Year %><br />
Your Profile Name is
<%=Profile .name %>
</div>
Enter Name:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
Enter Day:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
Enter Month: <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
Enter Year : <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" />
<br />
</form>
</body>
</html>
Output
<system.web>
<anonymousIdentification enabled ="true"/>
<profile>
<properties >
<add name="name" type ="string" allowAnonymous ="true"/>
<add name ="DOB" type ="dateofbirth" allowAnonymous ="true"/>
</properties>
</profile>
<authentication mode="Forms" />
<compilation debug="false" targetFramework="4.0" />
</system.web>
Class File Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for dateofbirth
/// </summary>
public class dateofbirth
{ private string day;
private string month;
private string year;
public string Day
{
get
{
return day;
}
set
{
day = value;
}
}
public string Month
{
get
{
return month;
}
set
{
month = value;
}
}
public string Year
{
get
{
return year;
}
set
{
year = value;
}
}
public dateofbirth()
{
}
}
Source code
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Profile .name =TextBox1 .Text ;
Profile .DOB.Day=TextBox2 .Text ;
Profile .DOB.Month =TextBox3 .Text ;
Profile.DOB.Year = TextBox4.Text;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>Your DateOfBirth is
<%= Profile.DOB .Day %>/
<%= Profile .DOB .Month %>/<%= Profile .DOB .Year %><br />
Your Profile Name is
<%=Profile .name %>
</div>
Enter Name:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
Enter Day:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
Enter Month: <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
Enter Year : <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" />
<br />
</form>
</body>
</html>
Я повелся на продвижение капли для похудения onetwoslim one-two-slim-kapli.ru. Я заказал одну упаковку, чтобы попробовать результат - цена 29 белорусских рублей. Они перезвонят через минуту - и попытаются "понюхать" курс из пяти упаковок, на самом деле это уже окажется не 29, а 145 рублей. Они обещают всевозможные скидки, если вы закажете курс или половину курса. Они убеждают меня. Я прошу вас попробовать одну упаковку, как она пойдет, как отреагирует организм, а барышни не собираются меня слушать - закажите курс!!! И, конечно, четверть - это часто. Я был поражен этой навязчивой идеей. Она повесила трубку. Поэтому не стоит "обманываться" привлекательной ценой. Один пакет рассчитан всего на 5 дней. Однако прямо есть мнение, что ни через какие пять дней результат не наступит. В наших аптеках действительно можно купить белорусские препараты с гарцинией, которые снижают аппетит и оцениваются в 13 рублей. Упаковка рассчитана более чем на месяц.
ReplyDelete