如何识别视图是否是部分视图 [英] How to identify a view is partial view or not
本文介绍了如何识别视图是否是部分视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
识别视图的任何特征是否是部分视图?
我知道部分视图前面带有显示可重用的_符号。
其他任何特点???
谢谢高级
Ashish kumar verma
Any characteristics to identify a view is partial view or not?
I know that partial view is preceded with _ sign that shows for reusable.
Any other characteristics???
Thanks in advanced
Ashish kumar verma
推荐答案
部分视图之间的标记没有区别和一个观点;唯一的区别在于它们如何传递到浏览器。部分视图通过AJAX发送,必须由客户端的JavaScript使用,而View是完整的回发。而已。
通常这意味着View更像是一个完整的网页,而且部分视图是为各个部分或控件保留的。但实际上,您可以将完全相同的.cshtml作为局部视图或视图发送。
_ prepend不一定是部分视图的指示,在MVC.NET视图中,它只是本身用于_Layout和_ViewStart。我个人用它来表示我的母版页的各个部分,但这是个人惯例。
There is no difference in the markup between a partial view and a view; the only difference is in how they are delivered to the browser. A partial view is sent via AJAX and must be consumed by JavaScript on the client side, while a View is a full postback. That's it.
Normally this means that a View is more of a complete web page and a partial view is reserved for individual sections or controls. Realistically, though, you can send the exact same .cshtml as a partial view or as a view.
The _ prepend is not necessarily an indicator for a partial view, in MVC.NET views it's just natively used for _Layout and _ViewStart. I personally use it to indicate sections of my master page, but that's a personal convention.
这篇关于如何识别视图是否是部分视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文