Edit View Page

Now, we want to populate the view of edit page. Actually, the content is same as view from Add page. If we too lazy, we could just copy and paste it. Not in Makers Institute.

I would like to introduce you about Partial View.

Partial View works with reusing the view page so it could be used with different purpose.

  1. Right-click at Entries folder in View folder > Add > View.
  2. Change the view name to _EntryForm.
  3. Tick on "Create a partial view".
  4. Copy the @model and @using from Add view page.
  5. Then, copy paste the remaining code from @using(Html.BeginForm()).
  6. Finally, we just call the Partial view with this code.
    @Html.Partial("_EntryForm")
    
  7. Do this method in Edit View too.

results matching ""

    No results matching ""