Apply the user interface design for a web application
介绍了Css的常用属性和html5的新element,以及Htmlhelper的简单方法,如BeginForm, TextBox, TextArea。
Design and implement UI behavior
- client validation:
在Model中使用attribute binding to property,在View中使用EditorFor/ValidationMessageFor实现client validation。
Server side再通过ModelState.IsValid来check。
- remote validation
通过Remote("Action", "Controller")属性binding to property,
如下web.config中key的value需为true。
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
- 使用AJAX更新部分page
- 使用jQuery实现UI
Compose the UI layout of an application
- 用partial view实现公共部分,@Html.Partial("partialPage")
- 使用Razor的templates实现如EditorFor这类功能,~/Views/ControllerName(Shared)/EditorTemplates/Templatename.cshtml, ~/Views/ControllerName(Shared)/DisplayTemplates/Templatename.cshtml
- 使用Master page,Layout可变,if(ViewBag.switch=="layout1") Layout = “~/Views/Shared/_plainLayout.cshtml"; else Layout = "~/Views/Shared/_Layout.cshtml";
Enhance application behavior and style based on browser feature detection
- 使用userAgent header的信息判断browser的名字,如IE
- 通过DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("")...),支持不同的display mode。
Plan an adaptive UI layout
- 使用<meta> tag和CSS的@media查询指定layout
- 使用jQuery.Mobile.MVC
---------------------------
知道的更多,不知道的也更多
---------------------------
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步