David Watson

David Watson

  • NA
  • 15
  • 2k

Reusing View in Another View or Not?

Feb 10 2017 5:44 PM
I am working on my very first ASP.NET site.  I have absolutely no experience with C#, HTML or websites of any sort.  However, by working diligently and repeating tutorials I have kind of got enough of a hang of it to try this first project.  However I still feel very lost...but slowly feeling my way.
 
The project is something I would expect in a years time to knock over in under an hour. 
 
I have three tables.  I have created these in EF, and populated the data with initialiser where required and created views and controllers - all good.  Most issues I have encountered I have slowly worked through to resolve on my own with google help.  But I am unclear what to do here and I have tried google to no avail.
 
My structure is:
Site
WaterBody
Condition
 
I have the controllers and views for
Site
Waterbody 
 
From my home page I want to add a repeat of the site view.  I don't want to be able to add, edit, delete or see details from this view.  All I want to be able to do...at this stage is see the sites already entered, then following a tutorial I was going to add the ability to select a site and show the water bodies belonging to that site.  Fairly simple I would think.
 
The question I have is how to reproduce the view.
 
Do I need to:
- Create a new controller?
- Create a partial view?
- Code the partial view or the view again inside the Index for my home controller?
- Somehow reference the existing View in Site Index, from the Home Index and drag the data in that way?
- Or some other solution I haven't considered?
 
Please make the answer very simple.  I am struggling with this at this stage, but learning slowly. 
 
 

Answers (1)