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/