HiddenInput(DisplayValue = FALSE)] VS [ScaffoldColumn(假)] [英] HiddenInput(DisplayValue = false)] vs [ScaffoldColumn(false)]

查看:397
本文介绍了HiddenInput(DisplayValue = FALSE)] VS [ScaffoldColumn(假)]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是Exaclty ScaffoldColumn(假) HiddenInput(DisplayValue = FALSE)

What is Exaclty ScaffoldColumn(false) and HiddenInput(DisplayValue = false)?

和什么是这两者之间的主要区别?哪一个是最好用?

And What are the main difference between these two ? Which one is best to use??

谢谢!

推荐答案

[ScaffoldColumn(假)] 告诉Visual Studio中没有脚手架的列中视图。当您创建一个新的视图,您可以创建一个强类型的视图。当你这样做的Visual Studio要求你用什么模板(创建,编辑,列表等)。如果创建编辑/创建模板;例如,如果你把 [ScaffoldColumn(假)] 你的模型属性那么就不会产生DisplayFor()或EditorFor()在模板调用,因此它不会被包含在您的视图。

[ScaffoldColumn(false)] tells Visual Studio not to scaffold the column when generating a template for your view. When you create a new view, you can create a strongly typed view. When you do that Visual Studio asks you what template to use (Create, Edit, List, etc). If you create an Edit/Create template; for example, if you put [ScaffoldColumn(false)] on your model property then it just won't generate a DisplayFor() or EditorFor() call in the template, so it won't be included in your view.

[HiddenInput] 会告诉它应该为价值创造一个隐藏的HTML场DisplayFor / EditorFor方法。当您发布到一个表单,它会被包含在值,而这将是隐藏从视图中,当人们看它。

[HiddenInput] will tell the DisplayFor/EditorFor methods that it should create a hidden html field for that value. When you post to a form, it will be included in the values but it will be "hidden" from the view when people look at it.

这篇关于HiddenInput(DisplayValue = FALSE)] VS [ScaffoldColumn(假)]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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