What is view and model in MVC?

View: 300    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: ASP.NET Framework   Fields: none

9 point/1 review File has been tested

Model contains domain/business/application logic in the form of Object oriented programming pattern (classes). It holds data by using auto-implemented properties.

Introduction

Model:

MVC stands for model view and controller.

Model contains domain/business/application logic in the form of Object oriented programming pattern (classes). It holds data by using auto-implemented properties.

OR

Model also contains database code such as database connectivity code.

Example: UsersInformation.cs model

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace Lesson1.Models
{
    public class UsersInformation
    {
        public int id { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }
    }
}

View:

Views display/render the model data in the form of G.U.I (Graphical user interface). Views also contains the web controls such as textfields, drop downs, buttons etc. The files in view folder may have cshtml, aspx, html, asp or vbhtml file extensions depends on your language setting environment.

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<lesson1.models.usersinformation>" %>
<div>
        Date and Time is: <%= ViewData["DateTime"] %>
        Id:   <%= Model.id   %>
        Name: <%= Model.Name %>
        Id:   <%= Model.Surname %>
    </div>
</lesson1.models.usersinformation>


Example: Index.aspx view

 

What is view and model in MVC?

What is view and model in MVC? Posted on 22-08-2016  Model contains domain/business/application logic in the form of Object oriented programming pattern (classes). It holds data by using auto-implemented properties. 9/10 300

Comment:

To comment you must be logged in members.

Files with category

 

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd