Reputation: 781
How can i load partial view dynamically?I tried to use with querystring as below but i got error when runtime.
My code:
@Html.Partial("_Sample?id=3")
Upvotes: 0
Views: 1532
Reputation: 15148
You can do something like:
@Html.Action("Sample", "Users", new { UserId = 1 })
And in your UsersController
:
[ChildActionOnly]
public ActionResult Sample(int UserId)
{
// do stuff here
}
Upvotes: 1