How to create User Controls in ASP.NET MVC?

First of all, User Control is a concept in ASP.NET web form. While MVC only has three components, namely model, view, and control, asking how to create user control in MVC without defining which component user control belongs to is invalid. The following are instead the valid questions pertinent to user control.

How to create User Controls in Model?

How to create User Controls in View?

nested layout (master view, child view)

tag helper

Razor Declarative Helpers

– Inline Razor helpers

– Convert declarative helpers to tag helpers[1]Jon Galloway. Comparing MVC 3 Helpers: Using Extension Methods and Declarative Razor @helper Syntax. . 2011-03-23 [2018-01-28].

editor template, display template

How to create User Controls in Controller?

Render action, return partial view. A child request

References

Dino Esposito. ASP.NET MVC 5编程实战 第三版. 清华大学出版社. 978-7-302-39480-8.

   [ + ]

发表评论

电子邮件地址不会被公开。

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)