C# MVC跳转
2016-04-24 19:56
316 查看
MVC方式:
RedirectToAction(view?参数,控制器);
显示提示框,并返回上一页
Redirect("/控制器/视图?参数");
RedirectToAction("视图",new { 参数 });
RedirectToAction(view?参数,控制器);
当用Redirect或者RedirectToAction的时候,尽量使用false参数。在网页浏览的时候,有可能因为没有false导致网页线程中断。(猜测,没证据)
return View()
其他方式:
void情况的跳转,可以在script里写js跳转
RedirectToAction(view?参数,控制器);
return RedirectToAction("Index?id=" + eventid + "&type=6", "Event");
显示提示框,并返回上一页
return Content("<script>alert('暂时没有实践作业!');history.go(-1);</script>");
Redirect("/控制器/视图?参数");
return Redirect("/Home/Index?id=" + id + "&T=" + T + "");
RedirectToAction("视图",new { 参数 });
return RedirectToAction("Index", new { type = 1 });
RedirectToAction(view?参数,控制器);
return RedirectToAction("Index?id=" + id + "&type=1", "Home");
当用Redirect或者RedirectToAction的时候,尽量使用false参数。在网页浏览的时候,有可能因为没有false导致网页线程中断。(猜测,没证据)
return Response.Redirect(url1, false); return RedirectToAction("Index", "Home", false); return Redirect("/Index/Home");
return View()
//返回的是view页面,不会再走Controller return View("Index");
其他方式:
void情况的跳转,可以在script里写js跳转
Response.Write("<script>alert('文件未占用或文件未生成,请稍后重试!');window.close(); </script>");
相关文章推荐
- K 均值聚类算法-C#
- 【C#语法】C#中强转和as、is的区别
- 第五章变量的更多内容
- C#_会员管理系统:开发六(数据搜索)
- 在C#中使用NPOI2.0操作Excel2003和Excel2007
- CSharpGL(19)用glReadPixels把渲染的内容保存为PNG图片(C#)
- 简单对比C#程序中的单线程与多线程设计
- 【FTP】C# System.Net.FtpClient库连接ftp服务器(下载文件)
- C#详解struct和class的区别
- 关于C# 委托(delegate)与事件(event)的用法及事例
- [转]LibreOffice-SDK 开发实战:嵌入MFC-View 和 C# Winform
- C#OOP之三 控制结构
- C#OOP之三 控制结构
- C#OOP之三 控制结构
- c# 中button加图片
- C#基础-replace()过滤非法字符
- C# 通过循环清空窗体中所有 TextBox 的值
- c# winform笔记
- c#中using的用法详解
- C# textBox限定输入数字