1

for example, in a Action, I get data and it will be shown in two different place, so I create two partial views, ViewA and ViewB. So the question is: how to return partial view ViewA and ViewB in the Action?

3

1 Answer 1

1

If I understood your question correctly ...

Firstly, you can't return multiple views from a action since there can't be multiple return from a method. So to address your issue, create a model 'MODEL' with subclasses 'MODELA' and 'MODELB' in it catering the models for ViewA and ViewB. Create a view 'MainView', render the partial views ViewA and ViewB in 'MainView' using @Html.Partial. While rendering viewA and viewB, pass @Model.MODELA and @Model.MODELB respectively.

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.