Getting started with ASP NET MVC Dhananjay Kumar
- Slides: 31
Getting started with ASP. NET MVC Dhananjay Kumar @debug_mode http: //debugmode. net
Agenda Ø Ø Ø Getting started with ASP. NET MVC Understanding Controllers Understanding Views Understanding Model View. Bag, View. Data, and Temp. Data Strongly Typed and dynamic views Child Action and Partial Views Areas Database first approach Code first approach Using client side libraries like j. Query, Ignite UI
Give Away Tweet your experience about webinar using the hashtag #Infragistics or tag @infragistics to win cool goodies from us.
I am Dhananjay Kumar ØDeveloper Evangelist @infragistics Ø 6 times Microsoft MVP Ø@debug_mode Ødebugmode@outlook. com Øhttp: //debugmode. net
ASP. NET MVC Controller View Model
ASP. NET MVC ü Clean separation of concerns ü Enables or support Test Driven Development ü Easy integration with client side libraries like Java. Script, j. Query, and Ignite UI ü Developer has full control over the rendered HTML ü Due to stateless nature and URL routing, highly optimized for search engines ü Supports Authentication, authorization, configuration, compilation and deployment
Controller A Controller does all the actions in MVC. It handles user interactions or inputs. It passes user's data to a Model and selects a View to render on the UI. ü A Controller is a class ü It contains one or more methods called Actions ü An Action can return a simple string or a selected View to the UI ü Action takes all browser requests or user inputs ü It retrieves data from the Model ü It selects the View to be rendered on the UI
Controller
Controller Demo
Views are the components that display the application's user interface (UI) ü It renders user interface ü It contains markup to be rendered with the View. Engine ü There are two kinds of View. Engine in MVC- Razor and ASPX engine ü Controller may returns View ü View renders data from the Model returned by the Controller ü Controller can send data to View
View
View Demo
Model is a class which represents the problem domain. Model implements logic for the application data. ü Model is a class ü It is accessible to both the view and the controller ü Views renders data from the model ü Controller can pass data from model to the view ü Model class contain the application logic ü Model is place of the ORM or Data Access frameworks
Model ORM Business Logic Application data logic Model
Model Demo
Passing Data View. Bag • dynamic object to pass data from controller to view View. Data • dictionary object to pass data from controller to view Temp. Data • dictionary object to pass data from one controller/action to another controller/action
View. Bag and View. Data
Demo on View. Data and View. Bag
View. Bag and View. Data
Temp. Data
Temp. Data ü Temp. Data is used to pass data from one HTTP request to next HTTP request. ü In other words, Temp. Data is used to pass data from one controller to another controller or action to another action. ü Temp. Data is property of Base. Controller class. ü Temp. Data stores data in session object ü Temp. Data is property of Controller. Base class ü To read data Typecasting and null checking is required. ü Type of Temp. Data is Temp. Data. Dictionary. ü Temp. Data works with HTTP redirection like HTTP 302/303 status code
Temp. Data Demo
Types of Views Dynamic Views Strongly Typed Views
Different kinds of View Demo
Child Actions are the action methods which can be invoked within a view. ü Child Actions are the action methods which can be invoked within the view ü This is used to work with the data in the view, which are not related to the main action method ü In ASP. NET MVC any action can be used as a child action ü To use an action only as a child action and attribute it with the Child. Action. Only. It will make sure the action is not called by any user request and will only be used in the view.
Child Action Demo
Areas ü A MVC application can have any number of Areas ü Each Areas has its own controllers, models, and views. ü Physically Areas are put under separate folders. ü Areas are useful in managing big web applications
Areas Demo
Summary Ø Ø Ø Getting started with ASP. NET MVC Understanding Controllers Understanding Views Understanding Model View. Bag, View. Data, and Temp. Data Strongly Typed and dynamic views Child Action and Partial Views Areas Database first approach Code first approach Using client side libraries like j. Query, Ignite UI
What Infragistics can offer you? • We welcome all of you to take advantage of a FREE 30 Day Trial by downloading the product at: http: //www. infragistics. com/products/ultimate/download • Please reach out to us at Sales-India@infragistics. com for any follow up questions you may have. We welcome the opportunity to assist you.
- Getting ahead
- Asp.net core tutorialspoint
- Asp.net mvc 5 identity authentication and authorization
- Classic asp to asp.net migration
- Mathematica getting started
- Getting started with ft8
- Getting started with xilinx fpga
- Android development getting started
- Infuecers gone wild
- Unit 1 getting started
- Rancher slack channel
- English 9 unit 3
- Getting started with lua
- Getting started with vivado ip integrator
- Getting started with access
- Hi3ms
- Getting started with excel
- Unit 1 getting started
- Unit 1 my hobbies
- Unix for bioinformatics
- Getting started with eclipse
- Perl read_file
- Outlook tutorial 2010
- Poll everywhere register
- Local environment getting started
- Education splunk
- 大阪 microsoft asp.net
- Net core 1
- Asp.net execution model
- Asp net session state
- Asp.net web api 2
- 大阪 microsoft asp.net