Shetty
Shetty

Reputation: 1892

view and action method name

where does mvc stores the association between action method name and view page name? or who is responsible for checking if the there is a view page with name same as action method name?

Upvotes: 1

Views: 226

Answers (2)

ten5peed
ten5peed

Reputation: 15890

The ViewEngine takes care of all that for you.

Have a gander at this post about creating your own view engine... it gives you an idea of what's going on behind the scenes.

HTHs,
Charles

Upvotes: 1

Alex Gyoshev
Alex Gyoshev

Reputation: 11977

You are the one who specifies the relation between the view and the action. By default, when you return View();, ASP.NET MVC assumes that the view name is the same as the action name. You can, however, return View("About"); which will render the view page About.

There is no static checking -- the framework searches for the view at runtime. Therefore, the association is not stored anywhere.

Upvotes: 2

Related Questions