摘要: using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using iFlytekDemo.Models;namespace iFlytekDemo.Controllers{ public class CitiesController : Controller { private readonly ICityRepository cityRepository; // If you are using D... 阅读全文
posted @ 2014-05-01 14:18 MrMrCash 阅读(307) 评论(0) 推荐(0)
摘要: using System.Collections.Generic;using System.ComponentModel.DataAnnotations;namespace iFlytekDemo.Models{ /// /// 城市实体 /// public class City { /// /// 城市编号 /// [Key] public int CityID { get; set; } /// /// 城市名称 /// ... 阅读全文
posted @ 2014-05-01 14:12 MrMrCash 阅读(266) 评论(0) 推荐(0)
摘要: 假设cshtml文件中是这样的:data是json数据。传递到的Action是/Home/MyAjax。那么在Action方法处接收的方式如下:public ActionResult MyAjax(string val1) { string val2 = Requ... 阅读全文
posted @ 2014-05-01 14:09 MrMrCash 阅读(280) 评论(0) 推荐(0)
摘要: 在上一篇介绍MVC中的Ajax实现方法的时候,曾经提到了除了使用Ajax HTML Helper方式来实现之外,Jquery也是实现Ajax的另外一种方案。通过get方法实现AJax请求ViewClick MeControllerpublic ActionResult GetTime(){ r... 阅读全文
posted @ 2014-05-01 14:06 MrMrCash 阅读(1396) 评论(0) 推荐(0)
摘要: 使用asp.net mvc 调用Action方法很简单。一、无参数方法。1、首先,引入jquery-1.5.1.min.js 脚本,根据版本不同大家自行选择。2、在Controllers中书写前台Ajax需要调用的Action,比如:public ActionResult test1() ... 阅读全文
posted @ 2014-05-01 14:05 MrMrCash 阅读(452) 评论(0) 推荐(0)