0

For my Website model, I have a boolean property called isLive. My Index method shows the result of this property (if true it will display "live", "offline" otherwise). In my controller, I added a method called EditStatus that allows the user to update only the website's status. My EditStatus view (which belongs to the Websites controller) displays a dropdown menu with 2 options: Live/Offline. This is how I pass it to the Index view:

@Html.Partial("EditStatus", item)

I want to know how to pass the item's (aka the model) unique ID to this partial view so that specific model will be updated.

Vy Nguyen
  • 1
  • 1
  • 2
  • You question very similar to https://stackoverflow.com/questions/21172595/how-to-pass-model-to-partial-view. You can add `@model int` directive to your partial view, and then insert it with command `@Html.Partial("EditStatus", item.Id)` – Mark Shevchenko May 29 '17 at 10:27

1 Answers1

0

You can use viewdatadictionary: example:

@Html.Partial("EditStatus", new ViewDataDictionary { { "item", someInteger } });