C
C
Chamyys2018-08-17 12:08:49
JavaScript
Chamyys, 2018-08-17 12:08:49

How to add Partial View to main page?

I have a main page where I want to add Partial Views to the main page by clicking a button. How can I implement this better (C#, ASP.NET MVC)? Everyone

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fat Lorrie, 2018-08-17
@Chamyys

Partial Views (and Razor tools in general) are server-side rendering, there are no button clicks to speak of. There are generally two solutions here:

  1. render with display: none, and change style on click (JS or :checkedCSS )
  2. render on the client, already actually changing the DOM

V
Victor P., 2018-08-17
@Jeer

Once again, the question is, you have a PartialView, and you want to add something like this to the * .cshtml page:
Right?
But if this partial is added to several pages, then you are too lazy to type with your hands every time, do you want "one button"?
If ctrl+c, ctrl+v doesn't suit you, you can look towards the resharper. It has configurable hotkeys for custom pieces of code (you can preconfigure switches or something like that)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question