11
General Discussion / We could always create a view
« Last post by asim km on September 03, 2023, 11:28:24 pm »This is an abstract class that the result of the concrete operation inherits from. For example, , and all inherit from . By using the base class as the return type, this method can return any of its derived classes. Returning from a controller action is a common convention. Let's recap: We built a controller with an action that returns a view populated with a list of videos from the database. But where is the real view? We're going to create it now.
Go back to Solution Explorer, expand the Views folder, right click on Videos and go to Add View By convention, since we have a controller called Videos, we should have a folder here called Videos , which contains all the views of this controller will be used. In the Add View dialog box, set Phone Number List the view name to Index . Also, by convention, since our operation is called indexing, we can create a view with the same name. We don't have to abide by this agreement. with a different name, but following a convention helps us write less code to achieve the same thing.

Make sure Use Layout Page is checked and click . Image In the new dialog, in the Project Folders pane on the left, navigate to View Shared . On the right, select the first item: , and click OK . Click Add to finish adding the new view. Image So, what is layout? It is the template or master page for all our views. By using layouts, we can ensure that all views have the same look and feel. The default project template already has the layout you see when you preview the site. We can change this layout at any time to customize it to our needs. Let's take a look at the newly generated views: In , our views are files with the extension. In these files we can write and code.
Go back to Solution Explorer, expand the Views folder, right click on Videos and go to Add View By convention, since we have a controller called Videos, we should have a folder here called Videos , which contains all the views of this controller will be used. In the Add View dialog box, set Phone Number List the view name to Index . Also, by convention, since our operation is called indexing, we can create a view with the same name. We don't have to abide by this agreement. with a different name, but following a convention helps us write less code to achieve the same thing.

Make sure Use Layout Page is checked and click . Image In the new dialog, in the Project Folders pane on the left, navigate to View Shared . On the right, select the first item: , and click OK . Click Add to finish adding the new view. Image So, what is layout? It is the template or master page for all our views. By using layouts, we can ensure that all views have the same look and feel. The default project template already has the layout you see when you preview the site. We can change this layout at any time to customize it to our needs. Let's take a look at the newly generated views: In , our views are files with the extension. In these files we can write and code.
Recent Posts






