0

I have a user control I use multiple times on a page. It uniformly formats some object "X" and allows certain interactions. What I'd like to do is to pass a separate object to each separate instance of the user control. I'm currently rendering the controls as below, and just depending on some specific ViewData being set. I'd like to make it more generic than that.

<% Html.RenderPartial("Vignet"); %>

1 Answer 1

2

Use a strongly typed partial view, and pass the model explicitly:

<% Html.RenderPartial("Vignet", Model.VignetData); %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.