Re: Edited content save as PDF when I click a Button

  •  10-13-2015, 12:53 PM

    Re: Edited content save as PDF when I click a Button

    Hi,

     

    below is the code of it, you also can find it from the mvc demo controller file.

     

    1. protected Editor PrepairEditor(Action<Editor> oninit)  
    2.         {  
    3.             Editor editor = new Editor(System.Web.HttpContext.Current, "editor");  
    4.   
    5.             editor.ClientFolder = "/richtexteditor/";  
    6.             editor.ContentCss = "/Content/example.css";  
    7.             //editor.ClientFolder = "/Content/richtexteditor/";  
    8.             //editor.ClientFolder = "/Scripts/richtexteditor/";  
    9.   
    10.             editor.Text = "Type here";  
    11.   
    12.             editor.AjaxPostbackUrl = Url.Action("EditorAjaxHandler");  
    13.   
    14.             if (oninit != null) oninit(editor);  
    15.   
    16.             //try to handle the upload/ajax requests  
    17.             bool isajax = editor.MvcInit();  
    18.   
    19.             if (isajax)  
    20.                 return editor;  
    21.   
    22.             //load the form data if any  
    23.             if (this.Request.HttpMethod == "POST")  
    24.             {  
    25.                 string formdata = this.Request.Form[editor.Name];  
    26.                 if (formdata != null)  
    27.                     editor.LoadFormData(formdata);  
    28.             }  
    29.   
    30.             //render the editor to ViewBag.Editor  
    31.             ViewBag.Editor = editor.MvcGetString();  
    32.   
    33.             return editor;  
    34.         }  
    35.   
    36.         //this action is specified by editor.AjaxPostbackUrl = Url.Action("EditorAjaxHandler");  
    37.         //it will handle the editor dialogs Upload/Ajax requests  
    38.         [ValidateInput(false)]  
    39.         public ActionResult EditorAjaxHandler()  
    40.         {  
    41.             PrepairEditor(delegate(Editor editor)  
    42.             {  
    43.   
    44.             });  
    45.             return new EmptyResult();  
    46.         }  
     

    Regards,

     

    Ken 

View Complete Thread