ASP.NET MVC RC-使用代码隐藏创建MVC用户控件 [英] ASP.NET MVC RC - Creating a MVC User Control with a codebehind

查看:65
本文介绍了ASP.NET MVC RC-使用代码隐藏创建MVC用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图在发布候选版本中创建MVC用户控件,但看不到使用代码隐藏文件创建一个MVC用户控件. MVC视图页面也是如此.

Trying to create a MVC User Control in the Release Candidate and I can't see to make one with a codebehind file. The same is true for MVC View pages.

在Beta中创建视图会产生代码隐藏现象……我错过了什么吗?

Creating Views in the Beta would produce codebehinds...am I missing something?

推荐答案

后面的代码无法实现MVC框架的目的.功能应该与视图分开,MVC团队认为页面背后的代码与这种意识形态背道而驰,因此将其删除.

Code behind kind of defeats the purpose of the MVC Framework. Functionality should be kept separate from the view, the MVC team felt that code behind pages went against this ideology and therefore removed them.

您可以创建一个自定义帮助方法来创建您的控件.另外,我不确定MVC是否具有视图组件(Monorail/Castle),但这也可以是一种选择.

Your can create a custom helper method to create your control. Also I'm not sure if MVC has view components (Monorail/Castle) but that could be an option as well.

这篇关于ASP.NET MVC RC-使用代码隐藏创建MVC用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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