如何创建ASP.NET MVC可重复使用的控制 [英] How to create reusable control in ASP.NET MVC

查看:83
本文介绍了如何创建ASP.NET MVC可重复使用的控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何/我应该在创建ASP.NET MVC 3一些自定义控件?我有红色的有关部分的看法, ViewUsersControl Html.RenderAction ,但我还是不知道,哪个方向是正确的方式MVC剃刀意见。

How can/should I create some "custom control" in ASP.NET MVC 3? I have red about partial views, ViewUsersControl, Html.RenderAction, but I still don't know, which way is the proper MVC way for razor views.

如果我需要渲染一些Ajax组件来查看,我能想象通过局部视图做到这一点,但如果我想渲染定制逻辑部分?

If I need to render some ajax component to view, I can imagine to do it by partial view, but what if I want to render section with custom logic?

推荐答案

1)的 PartialViews

2)<一href=\"http://stackoverflow.com/questions/4804833/asp-net-mvc-3-custom-html-helpers-best-practices-uses\">Custom HTML辅助

3)儿童行动

这篇关于如何创建ASP.NET MVC可重复使用的控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆