Open file and Save Problem

Last post 08-01-2008, 7:46 AM by resooul. 4 replies.
Sort Posts: Previous Next
  •  07-30-2008, 10:13 AM 42639

    Open file and Save Problem

    Hi,
    Can you help me, i load content of a file to editor
    Like this:
    Editor1.LoadFile(filename);
    and i change this content with the editor. And i wanna save changes on the editor.
     
    i use this code:

                FileStream fs = File.Open(filename, FileMode.Create, FileAccess.ReadWrite);
                StreamWriter writer = new StreamWriter(fs, Encoding.UTF8);
                writer.Write(Editor1.XHTML);
                writer.Close();
                writer.Dispose();
                or
                textbox1.Text = Editor1.XHTML;

     When i clicked submit button, i cannot save to file.
    or i cannot add "Editor1.XHTML" to a textbox.
     
    (This codes are all right when Editor wasn't loaded from a file)
  •  07-30-2008, 1:29 PM 42641 in reply to 42639

    Re: Open file and Save Problem

    Please use the following method:
     

    Editor.SaveFile Method 

    Saves the contents of the Cute Editor to a file.

    [Visual Basic]
    Public Sub SaveFile( _
       ByVal path As String _
    )
    [C#]
    public void SaveFile(
       string path
    );

    Parameters

    path The name and location of the file to save.

    Remarks

    The SaveFile method enables you to save the entire contents of the control to a file. If the file name that is passed to the path parameter already exists at the specified directory, the file will be overwritten without notice. You can use the LoadFile, LoadWord, LoadRTF, LoadText method to load the contents of a file into the CuteEditor.

    Example

    editor1.SaveFile("~/doc/myHtmlfile.htm");
    

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-31-2008, 5:43 AM 42645 in reply to 42641

    Re: Open file and Save Problem

    I tried just like you say, but the problem is not about the only saving a file.
    No Problem with:
    İf (I load nothing to editor || The editor is empty)
     
                                      there is no problem the method Editor1.SaveFile(filename);
                                      it works very well;
    My Problem with:
    if (I load a content of file to editor || Something was initialized to editor)
     
                                      I cannot manage to save the file with changes;
                                      The saving process happends but Editor1.XHTML doesn't include the changes;
                                      Editor1.XHTML is the same with initialized form or was loaded from;
    Please Help...


  •  07-31-2008, 5:52 PM 42663 in reply to 42645

    Re: Open file and Save Problem

    resooul,
     
    Please check the source code of this example:
     
     
    If you still cannot figure it out the problem, please post your code.
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-01-2008, 7:46 AM 42681 in reply to 42663

    Re: Open file and Save Problem

    Adam thank you very much,
    I've solved the problem via the example you said.
    I did not control the page (IsPostBack) or not.
    This is my mistake.
    Editor is very usefull and im happy with using this editor.
    Thanks a lot the staff of this product.
    Great work :D.
View as RSS news feed in XML