ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【邹健】Asp.net MVC Fckeditor的扩展(支持PV3及自动绑定)

【邹健】Asp.net MVC Fckeditor的扩展(支持PV3及自动绑定)

原创 Linux操作系统 作者:iDotNetSpace 时间:2008-06-05 10:30:20 0 删除 编辑

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博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-332386/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-04

  • 博文量
    2376
  • 访问量
    5766209