Why you use Aspx ? Why you not try this Razor ?

“selamat malam minggu-an guys”

Hei i knew him there, what’s new in MVC 4.

before i explain this, i want u know what is MVC.

MVC is short from Model View Controller, look this Diagram below.Image

(image taked from wiki)

MVC is a method for making an application by separating data (model) from the view (View) and how to process it (Controller). 

In most implementations some framework web application based on MVC architecture. [1] MVC separates the development of applications based on the major components that build an application such as data manipulation, user interface, and part of the control in a web application.

 

so, MVC is just an architecture for building a web apps, thats it..

 

Now, MVC 4 offering a new style code, we call him RAZOR

just really, MVC 3 had razor, but what is the difference between Razor in MVC 3 and MVC 4 :

1. Syntax, look below:

Image

Razor in MVC 3, using tag <% =modelField %> 

but in MVC 4 look below:

Image

we could using tag @modelField, but if u embed your model to your file .cshtml look below :

Image

number 1. Declare viewModel that return from controller.

number 2. ViewBag is a Dynamic code when developer wanna return a object from controller, but just one way, controller -> view, and not return value from view -> controller.

number 3. if u see view source it is a tag for <form>

number 4. yeah.. its how i like Razor MVC 4, we only type this @Html.TexBox(“stringName”, value, objectHtmlattribute).

If u want embed modelField value to textbox, you just type @Html.TexBoxFor(model => model.modelField) using lambda expression.

tobe continued…

sleep tonight.. salam “will code for food”

 

 

Iklan
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: