Question: Location the anchor tag for Home, About and contact buttons


Location the anchor tag for Home, About and contact buttons

Answers 3
Added at 2017-11-07 19:11

I am new to MVC web development. I created the default MVC application! In the top of the Home page You find Home,About and contact buttons.

But When I checked the index.cshtml I can not find the code for Home,About and contact buttons!

I searched other files in the solution but was very hard to locate them! In which file can I find the code for these buttons?

Answers to

Location the anchor tag for Home, About and contact buttons

nr: #1 dodano: 2017-11-07 19:11

While adding view to your project it show option to include layout page,


By default c# mvc application contains layout.cshtml page which contain your about, home etc links.

So by enabling layout.cshtml to your page help you out.

If you want to add it manually then create anchor tag to your page which contain 'href' that contain links.Also make methods in controller to handle link clicks.

You can also add your own layout.cshtml page which contain link to your home,about, contact us etc and refer layout.cshml to every other cshtml page.

nr: #2 dodano: 2017-11-07 19:11

Your looking for Layouts.


Most web apps have a common layout that provides the user with a consistent experience as they navigate from page to page. The layout typically includes common user interface elements such as the app header, navigation or menu elements, and footer.

nr: #3 dodano: 2017-11-07 19:11

yes..kushan....that is why it is suggested in mvc that to start with

empty mvc application enter image description here

instead of going for the ready made template ..

Because by manually creating each part you would learn the use of layout , partialview , how to add scripts & webconfig , startup.cs etc

anyways the corresponding code for your landing page enter image description here

could be found in the respective controller & views folder enter image description here

Source Show
◀ Wstecz