Testpaperonmvc
Testpaperonmvc
Ans : Model - The Model represents the data and the business logic of the
application. It is responsible for managing the data, processing user inputs,
and performing Tasks. It is relation with database ceratin updation re retrival
data will be updated through model .
controller - Controller is the intermediate between the model and views .It
receive input from the user and perform ceratin application . It receives user
inputs from the View, processes them, and updates the Model accordingly. It
also updates the View with the changes in the Model.
Ans: ASP.NET MVC provides a set of data annotation attributes that you can
use to validate your model data. These annotations help ensure that the data
entered by users is valid and meets specific criteria before it is processed.
Validation can happen on both the client side and the server side
When user nevigate to a perticular url the requesent send to the routing
before the controller , requested url check in route table then the matching
url will send request in specific controller then controller perfom next
function according that .
Ans: Loosely Typed HTML Helpers are methods that create HTML elements
without being directly tied to your model's properties. They use string
parameters to define the names and values of these elements. This means
they don't check if the names you use match any properties in your model
until the application runs.
Ex textbox
7 What is Strongly Typed Html Helper.
Ans: Strongly Typed HTML Helpers are methods that use lambda
expressions and strongly typed model data. They provide compile-time
checking, meaning that errors can be caught during development, making
them safer and more reliable.
Ex TextboxFor
1 code first : in the code first approch you will start wrinte first code and
accorfing to the classes EF will generate database schema .
3 Model first : in Model first create model First then generate the
database scema according to the model .
Ans: ViewData: ViewData is a dictionary object that allows you to pass data
from a controller to a view. It requires typecasting to access the data.
ViewBag: ViewBag is a dynamic object that allows you to pass data from a
controller to a view without needing to define a strongly-typed class. It uses
dynamic properties, so you don’t need to cast types. It only lasts for the
duration of the current request.
Once the request sent to the client the data will be loss
TempData: A dictionary object used to pass data between Controller actions.
The data in TempData persists until it is read. Once read, the data is
removed. It survives multiple requests as long when it is not been read.