1

I would like to avoid cluttering up my View (.cshtml) with the SVG-data. Is there a way to put it in a separate file and input this file in my view (like Latex' \input{})?

Does it make sense to use a partial view?

u17
  • 2,776
  • 4
  • 31
  • 43

1 Answers1

1

Yes, I would highly suggest rendering partial views. It is an easy way to separate large amounts of html out if it is representative of data. You might also consider rendering a partial view with a template if you have a model that includes many occurrences of the same data.

Just replace your applicable html/data with a call to @Html.Partial("ViewName") or @Html.Partial("ViewName", model) where you'd like to clean up that clutter.

See this discussion on the efficiency of partial views vs. using model templates to separate html out of a view.

Community
  • 1
  • 1
ElliotSchmelliot
  • 7,322
  • 4
  • 41
  • 64