MVC (Model view Controller) Model View Controller The first version of MVC is called MVED(Model View Editor) MVC is to multi layer architecture Model (class and variables) View (.cshtml) Controller (Logic building) MVC is directly operate html page in this reason it is called light weight environment. MVC Block Diagrame .NET Framework ASP.NET MVC ASP.Net Webform Benefits of MVC application It is manage complex application Direct control use in html It provide test driven development testing to (url http/data)
Theory :- PASSING DATA FROM A CONTROLLER TO A VIEW IN MVC In an ASP.NET MVC application, a controller typically performs the business logic of the application and needs to return the result to the user through a view. You can use the following objects to pass data between controller and view: Ø ViewData Ø ViewBag Ø TempData ViewData · Passes data from a controller to a view. · Is a dictionary of objects that is derived from the ViewDataDictionary class. · Some of the characteristics of ViewData are as follows: · The life of a ViewData object exists only during the current request. · The value of ViewData becomes null if the request is redirected. · ViewData requires typecasting when you use complex data type to avoid error. The general syntax of ViewData is as follows: ViewData[“<Key>”] = <Value>; where, Ø Key : Is a String value to identify the object present in ViewData. Ø Value : Is the object present...
HTML HELPER METHODS IN ASP.NET MVC 5 In ASP.NET MVC Framework, helper methods: Ø Are extension methods to the Html Helper class, can be called only from views. Ø An HTML helper is a method that is used to render html content in a view. Ø Simplifies the process of creating a view. Ø Allows generating HTML markup that you can reuse across the Web application. Some of the commonly used helper methods while developing an MVC application are as follows: Ø Html.ActionLink() Ø Html.BeginForm() and Html.EndForm() Ø Html.Label() Ø Html.TextBox() Ø Html.TextArea() Ø Html.Password() Ø Html.CheckBox()
Comments
Post a Comment