【鄒健】Asp.net MVC Fckeditor的擴充套件(支援PV3及自動繫結)

iDotNetSpace發表於2008-06-05

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/

--&gtnamespace 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/

--&gt

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章