Skip to main content

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

How to create user profile using Complex DataType in ASP.NET

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
How to create user profile using Complex DataType in ASP.NET

Comments

  1. Я повелся на продвижение капли для похудения onetwoslim one-two-slim-kapli.ru. Я заказал одну упаковку, чтобы попробовать результат - цена 29 белорусских рублей. Они перезвонят через минуту - и попытаются "понюхать" курс из пяти упаковок, на самом деле это уже окажется не 29, а 145 рублей. Они обещают всевозможные скидки, если вы закажете курс или половину курса. Они убеждают меня. Я прошу вас попробовать одну упаковку, как она пойдет, как отреагирует организм, а барышни не собираются меня слушать - закажите курс!!! И, конечно, четверть - это часто. Я был поражен этой навязчивой идеей. Она повесила трубку. Поэтому не стоит "обманываться" привлекательной ценой. Один пакет рассчитан всего на 5 дней. Однако прямо есть мнение, что ни через какие пять дней результат не наступит. В наших аптеках действительно можно купить белорусские препараты с гарцинией, которые снижают аппетит и оцениваются в 13 рублей. Упаковка рассчитана более чем на месяц.

    ReplyDelete

Post a Comment

Popular Post

Polynomial representation using Linked List for Data Structure in 'C'

Polynomial representation using Linked List The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows: Polynomial:      3x 3 -4x 2 +2x-9 Linked List: In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable. Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also

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

Memory representation of Linked List Data Structures in C Language

                                 Memory representation of Linked List              In memory the linked list is stored in scattered cells (locations).The memory for each node is allocated dynamically means as and when required. So the Linked List can increase as per the user wish and the size is not fixed, it can vary.                Suppose first node of linked list is allocated with an address 1008. Its graphical representation looks like the figure shown below:       Suppose next node is allocated at an address 506, so the list becomes,   Suppose next node is allocated with an address with an address 10,s the list become, The other way to represent the linked list is as shown below:  In the above representation the data stored in the linked list is “INDIA”, the information part of each node contains one character. The external pointer root points to first node’s address 1005. The link part of the node containing information I contains 1007, the address of