public ActionResult InfoFrame()
{
List<Users> list = new List<Users>();
Users user = new Users();
if (Session["UserID"] == null)//判断是否没登录
{
return RedirectToAction("LoginIndex", "Login");
}
else
{
string sql = string.Format(@"SELECT * FROM Users WHERE UserID='{0}'", Session["UserID"]);
list = DB.Database.SqlQuery<Users>(sql).ToList();
user.UserName = list[0].UserName;
}

return View(user);
}

@{
//ViewBag.Title = "InfoFrame";
}
@*@model List<MVCWEB.Models.Users>*@
@model MVCWEB.Models.Users

<html>
<head>
<link href="~/Content/css/layui.css" rel="stylesheet" />
<link href="~/Content/css/style.css" rel="stylesheet" />
<link href="~/Content/css/iconfont.css" rel="stylesheet" />
<script src="~/Scripts/jquery.js"></script>
<script src="~/Scripts/layer.js"></script>
<script src="~/Scripts/layui.js"></script>

</head>
<body>
<form class="layui-form" action="" style="margin-left:0px; margin-left:100px">
<div class="layui-form-item">
</div>
<div class="layui-form-item">
<label class="layui-form-label" style="font-size:18px;">帐号:</label>
<div class="layui-input-block">
<input type="text" name="title" value="@Model.UserName" required lay-verify="required" @*placeholder="请输入帐号"*@ autocomplete="off" class="layui-input" readonly="readonly" style="width:500px;font-size:16px">
</div>
</div>

mvc 返回一个对象 到视图接收的更多相关文章

  1. MVC控制器返回一个list 视图接收

    控制器 public ActionResult InfoFrame() { List<Users> list = new List<Users>(); if (Session[ ...

  2. spring mvc返回json字符串的方式

    spring mvc返回json字符串的方式 方案一:使用@ResponseBody 注解返回响应体 直接将返回值序列化json            优点:不需要自己再处理 步骤一:在spring- ...

  3. [.net 面向对象程序设计深入](6).NET MVC 6 —— 模型、视图、控制器、路由等的基本操作

    [.net 面向对象程序设计深入](6).NET MVC 6 —— 模型.视图.控制器.路由等的基本操作 1. 使用Visual Studio 2015创建Web App (1)文件>新建> ...

  4. MVC(Model(模型) View(视图) Controller(控制器))

    复习 1.      商品表 增删改查 index.php  add.php   view.php   edit.php   action.php 2.      MVC(Model(模型)  Vie ...

  5. Spring Mvc 返回机制

    转自:http://jianzh5.iteye.com/blog/1909234 Spring Mvc 有如下的几种返回方式: ModelAndView, Model, ModelMap, Map, ...

  6. ASP.NET Core MVC之ViewComponents(视图组件)

    前言 大概一个来星期未更新博客了,久违了各位,关于SQL Server性能优化会和ASP.NET Core MVC穿插来讲,如果你希望我分享哪些内容可以在评论下方提出来,我会筛选并看看技术文档来对你的 ...

  7. MVC使用jQuery从视图向控制器传递Model,数据验证,MVC HTML辅助方法小结

    //MVC HTML辅助类常用方法记录 (1)@Html.DisplayNameFor(model => model.Title)是显示列名, (2)@Html.DisplayFor(model ...

  8. ASP.NET Core MVC之ViewComponents(视图组件)知多少?

    前言 大概一个来星期未更新博客了,久违了各位,关于SQL Server性能优化会和ASP.NET Core MVC穿插来讲,如果你希望我分享哪些内容可以在评论下方提出来,我会筛选并看看技术文档来对你的 ...

  9. spring mvc 返回类型

    spring mvc处理方法支持如下的返回方式:ModelAndView, Model, ModelMap, Map,View, String, void 小结:1.使用 String 作为请求处理方 ...

随机推荐

  1. 修改json对象的每一个值

    function fun1(obj){ var names={}; /*for in 可以用于数组或者对象*/ for(var name in obj){ names[name] = obj[name ...

  2. Linux运维高级-核心知识提高

    一.Linux之定时任务crond 二.Linux之用户管理 三.Linux之初识磁盘 四.Linux之磁盘管理 五.Linux三剑客-SED 六.Linux三剑客-AWK 七.初识shell编程 八 ...

  3. 通过Excel生成PowerDesigner表结构设计

    说明:近期做部分表结构设计,在word里设计调整好了,需要整理到PowerDesigner中,但是手工录入太麻烦. 找了个工具(地址:http://www.cnblogs.com/hwaggLee/p ...

  4. c# throw和throw ex

    c# throw和throw ex 我们在日常开发当中,经常会用到exception异常,并且我们会在exception中的catch块中throw exception,例如: static void ...

  5. Python 输出文件内容到网络端口

    Python 输出文件内容到网络端口 $ cat mySocketTest.py import sys import time import socket if __name__ == "_ ...

  6. 遍历CheckBox根据指定条件做筛选js

    $('#del').click(function(){ var checkeds=$('input[name=cid]:checked') checkeds.each(function() { var ...

  7. Each path can be reduced to a simple path

    Recently, I made a small conclusion, but I found it is found and well-founded in some textbook. So I ...

  8. Python中getopt()函数的使用

    在运行程序时,可能需要根据不同的条件,输入不同的命令行选项来实现不同的功能.目前有短选项和长选项两种格式.短选项格式为"-"加上单个字母选项:长选项为"--"加 ...

  9. Python之使用转义序列 \n 和 \t 跟 expandtabs 函数输出表格

    示例: text = "username\temail\tpassword\nashdfh\tfiodfh@q.com\ty567\nsdfiuh\tadfhisoj@163.com\t42 ...

  10. springboot 学习进度

    1 hello world --------------ok 主启动程序必须在层次结构的最上面. 2 配置 3.日志 4.Web开发 1)SpringBoot集成JSP的方法 配置applicatio ...