【邹健】Asp.net MVC Fckeditor的扩展(支持PV3及自动绑定)
Asp.net MVC Fckeditor的扩展(支持PV3及自动绑定)
function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->namespace System.Web.Mvc
{
using System;
///
/// 对Controller的Redirect操作的扩展
/// blog:http://chsword.cnblogs.com/
///
public static class RedirectExtension
{
///
/// 重定向到上一个Action. 即 header 的 "HTTP_REFERER" (Context.UrlReferrer).
///
static public void RedirectToReferrer(this Controller controller) {
controller.Response.Redirect(controller.Request.ServerVariables["HTTP_REFERER"]);
}
[Obsolete("已经过时请使用RedirectToReferrer")]
static public void RedirectToReferer(this Controller controller)
{
RedirectToReferrer(controller);
}
///
/// Redirect 到站点根目录 (Context.ApplicationPath + "/").
///
static public void RedirectToSiteRoot(this Controller controller) {
controller.Response.Redirect(controller.Request.ApplicationPath + "/");
}
}
}
Pv3中已经有了,不过void的情况下不支持,还是有其可用性的
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
namespace System.Web.Mvc
{
using System;
using System.Text;
using System.Web.Script.Serialization;
using System.Runtime.Serialization.Json;
///
/// 对RenderView的扩展
/// blog:http://chsword.cnblogs.com/
///
static public class RenderExtension
{
///
/// 显示要显示的文本
///
///
/// 文本内容
[Obsolete("仅在Asp.net Mvc Preview2中使用,PV3中已经提供新的方法Content")]
static public void RenderText(this Controller c, string str)
{
c.HttpContext.Response.Write(str);
}
///
/// 将要显示的对象以JSON返回要客户端
///
///
/// 要发送的对象
[Obsolete("仅在Asp.net Mvc Preview2中使用,PV3中已经提供新的方法Json")]
public static void RenderJSON(this Controller c, object data)
{
c.RenderJSON(data, null);
}
///
/// 将要显示的对象以JSON返回要客户端
///
///
/// 要发送的对象
/// 传送的Content-Type默认为application/json
[Obsolete("仅在Asp.net Mvc Preview2中使用,PV3中已经提供新的方法Json")]
public static void RenderJSON(this Controller c, object data, string contenttype)
{
c.RenderJSON(data, contentType, null);
}
///
/// 将要显示的对象以JSON返回要客户端
///
///
/// 要发送的对象
/// 传送的Content-Type为空则默认为application/json
/// 编码方式
[Obsolete("仅在Asp.net Mvc Preview2中使用,PV3中已经提供新的方法Json")]
public static void RenderJSON(this Controller c, object data, string contenttype, Encoding encoding)
{
HttpResponseBase response = c.HttpContext.Response;
if (!string.IsNullOrEmpty(contenttype))
{
response.ContentType = contenttype;
}
else
{
response.ContentType = "application/json";
}
if (encoding != null)
{
response.ContentEncoding = encoding;
}
if (data != null)
{
DataContractJsonSerializer sr = new DataContractJsonSerializer(typeof(object));
sr.WriteObject(response.OutputStream, data);
}
}
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12639172/viewspace-332386/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12639172/viewspace-332386/
【邹健】Asp.net MVC Fckeditor的扩展(支持PV3及自动绑定)相关推荐
- asp.net mvc fckeditor全攻略(补充:Controller中传值的问题)
开篇仍然要叙述我的环境 环境说明: 软件环境:asp.net mvc3 + vs2010 系统环境:windows xp sp3 浏览器: ie8(为了世界的和平,为了社会的稳定,为了不再被大 ...
- [ASP.NET MVC]让Html.RenderAction支持Lamda表达式
今天在ASP.NET MVC代码时用到了Html.RenderAction,代码如下: @{Html.RenderAction("RecentNews")} 通过字符串指定Acti ...
- ASP.NET MVC:多模板支持
背景 准备写个博客练习一下WEB编程,有一个需求就是多模板支持,类似博客园的自定义模板一样,在ASP.NET MVC中如何处理这个需求呢? 需求 描述 允许自定义模板,比如:传统模板.Metro模板等 ...
- mvc html绑定变量,c# – Asp.Net MVC 3使用变量对象进行自定义模型绑定
我的实体:( PersonModel应该有一个AddressOne或AddressTwo类型的地址(可能还有其他),所以PersonModel有一个地址字段的对象类型.) public class P ...
- ASP.NET MVC模式下使用fluentscheduler+stmp定时自动发送邮件
STMP发送邮件 首先说STMP自动发送邮件 在解决方案下新建一个类,我命名为EmailHelper(但是怎么命名无所谓啦) using System; using System.IO; using ...
- ASP.NET MVC Framework 系列
序言 做为设计模式的王者,MVC在众多领域都成为良好的模型的代名词,从前在ASP.NET下我们只能依靠Monorail来实现ASP.NET下无控件的MVC,但是现在ASP.NET 下的MVC已经成为现 ...
- ASP.NET MVC 重点教程一周年版 第九回 HtmlHelper 【转】
许多时候我们会遇到如下场景 在写一个编辑数据的页面时,我们通常会写如下代码 1: <input type="text" value='<%=ViewData[" ...
- ASP.NET MVC 重点教程一周年版 第九回 HtmlHelper
许多时候我们会遇到如下场景 在写一个编辑数据的页面时,我们通常会写如下代码 1: <input type="text" value='<%=ViewData[" ...
- ASP.NET MVC 2 模型验证
2019独角兽企业重金招聘Python工程师标准>>> [原文地址]ASP.NET MVC 2: Model Validation [原文发表日期] Friday, January ...
最新文章
- Centos7上yum安装mongodb4-2
- Dell R410/710 升级网卡驱动
- 埃隆·马斯克:比特币拥有着“极为出色”的结构,而纸质货币终将消失
- 哈夫曼树(最优二叉树)(c/c++)
- VS2008 error RC2170: bitmap file xxx.png is not in 3.00 format(转)
- 队列和消息队列_消息队列概述[幻灯片]
- Java得到请求的IP地址
- mysql 表 类型_mysql表类型
- Python maximum recursion depth exceeded while calling a Python object (gevent的SSL无限递归错误)的问题解决
- 2018-2019-1 20189218《Linux内核原理与分析》第九周作业
- qt为lineedit添加背景图片代码_Qt中事件的理解(2)
- IndexedDB 简单封装
- Linux系统编程 -- 信号及signal函数
- 130242014057 周陈清 实验一
- win8 32位系统上如何运行校园翼讯客户端
- E: Unable to locate package mingw32
- js 判断图片和视频是否加载成功
- 游吟诗人之中二病犯了
- 关于cocos2dx 3.0 跳转场景
- Java Heap - Percolate Up, Percolate Down, and Heapify