Rajesh Thampi

Rajesh Thampi

  • NA
  • 128
  • 5.4k

How to bind Main view model values to partial view?

Jun 14 2023 10:42 AM

Hi guys

I tried to post this question few minutes back, not appearing anywhere. My  .Net Core 5.0 application has 4 different types of service tickets & my index page lists all pening service tickets. I can open a particular service ticket and view the details for it along with the comments against the same.

As the comments are saved against the service ticket id and the type of service ticket, I would like to use a partial view that I can call from all types of service ticket details view. I already know how to define a patial view and show it, however don't know how to bind a model based on the main view model.

For example, if I am viewing details for a service ticket for type "CA" and the service ticket id is "100", I want my partail view to show all comments associated with the id "100" and type "CA".

So far I created a view model that has both the service ticket details and comment objects & looks like that is irrelevant.

Please help ??


Answers (3)