分类: iOS平台
2013-12-18 22:41:56
1、添加布页
在~/Areas/Admin/Views/Shared中添加_Layout.cshtml。
后台页面采用easyui的layout,分north、south、west、center四个部分。代码如下:
@Styles.Render("~/Css/Admin")
@Styles.Render("~/Css/Admin/Easyui")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/Scripts/Easyui")
@Scripts.Render("~/Areas/Admin/Scripts/global.js")
@Html.Action("PartialNorth","Home")
@RenderBody()
2、后台管理的主页——Home
在~/Areas/Admin/Controllers 添加【HomeController】
为[Index] action添加视图
@{
ViewBag.Title = "管理中心";
}
这里用到了easyui的lay
out和tabs。
添加返回分部视图的action [PartialNorth] 这个在布局也中调用,显示layout的North部分,也就是页面的头部(图中1的位置)。
///
/// 顶部视图
///
///
public PartialViewResult PartialNorth()
{
return PartialView();
}
添加相应视图。
1: public static class HttpRequestMessageExtensions
2: {
3: public static void SetCurrentUICulture(this HttpRequestMessage request)
4: {
5: StringWithQualityHeaderValue acceptCultureHeader = request.Headers.AcceptLanguage.OrderByDescending(header => header.Quality).FirstOrDefault();
6: if (null != acceptCultureHeader)
7: {
8: request.Properties["__CurrentCulture"] = Thread.CurrentThread.CurrentUICulture;
9: Thread.CurrentThread.CurrentUICulture = new CultureInfo(acceptCultureHeader.Value);
10: }
11: }
12:
13: public static void ResetCurrentUICulture(this HttpRequestMessage request)
14: {
15: object culture;
16: if (request.Properties.TryGetValue("__CurrentCulture", out culture))
17: {
18: Thread.CurrentThread.CurrentUICulture = (CultureInfo)culture;
19: }
20: }
21: }
1: public class UseAcceptCultureAttribute: ActionFilterAttribute
2: {
3: public override void OnActionExecuting(HttpActionContext actionContext)
4: {
5: actionContext.Request.SetCurrentUICulture();
6: }
7:
8: public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
9: {
10: actionExecutedContext.Request.ResetCurrentUICulture();
11: }
12: }
ios网络编程的小技巧有助于我们更好的操作ios网络编程相关任务,使得我们在操作ios网络编程的时候能够更为清楚的知道自己到底是应该怎么样操作才能够达到更好的操作效果以及操作过程中需要注意的问题。