How to create User Controls in ASP.NET MVC?

2018年1月27日

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]

editor template, display template

How to create User Controls in Controller?

Render action, return partial view. A child request

References

[CiteBook author=”Dino Esposito” title=”ASP.NET MVC 5编程实战” edition=”第三版” publisher=”清华大学出版社” isbn=”978-7-302-39480-8″]

参考资料

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