部分视图VS Html助手 [英] Partial Views VS Html helpers

查看:79
本文介绍了部分视图VS Html助手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

当我们应该使用部分视图时我们应该使用html帮助器吗?

我有一堆用户控件ASCX有很多标签和html而在另一个我用C#创建了一些自定义控件。两者都包含javascript。

那么将这些控件转换为MVC的最佳方法是什么?

谢谢

解决方案

你无法真正从ascx转换到MVC,但你可能得到的最接近的是将控件实现为部分视图,这样你就可以将它们包含在需要的。

Hello
When we should use partial views and we should use html helpers?
I have a bunch of user controls ASCX with lot of tags and html and in another hand I had some custom controls created with C# .and both of them include javascript .
so what's the best way to convert those controls to MVC?
Thank you

解决方案

You can't really "convert" from ascx to MVC, but the closest you'll probably get will be to implement your controls as partial views so you can included them where needed.


这篇关于部分视图VS Html助手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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