SaveAs and Open dialogs

Last post 06-11-2004, 12:19 AM by colin. 8 replies.
Sort Posts: Previous Next
  •  06-07-2004, 3:16 PM 953

    SaveAs and Open dialogs

    Hi all,

     
    I'm thinking of using this for an online app where we save text to the database as "files" to be edited later.  ie...each row has file_name and file_text columns  that allow the text to be reloaded, edited and then saved again.
     
    So I'm thinking I need an Open dialog which shows current "files" to choose from and then when selected opens the correct row and populates the editor with the file_text dependant on the file_name opened.  And I'll most likely need a SaveAs dialog that takes a file_name and allows the ability to either add a new "file/row" if the name doesn't exist or save the file_text correctly to the right row using an existing file_name.
     
    With that in mind, has anybody else done this bit?  I'd think this functionality is something that comes up a lot around here.  I've already done this for another editor, FTB, so if possible it'd be nice not to have to redo it again. 
     
    Any help is much appreciated!
     
    -C
  •  06-07-2004, 5:59 PM 954 in reply to 953

    Re: SaveAs and Open dialogs

    Prior to this control I also used FTB, and this control can get you the text as well...see post http://www.cutesoft.net/Forums/ShowPost.aspx?PostID=323. As far as the rest of your code, it should work as is...after you change the control names of course and update your menu definitions. FTB did not allow custom buttons and actions when I was using it...but you can with CuteEditor...this should provide relief for your preference.

    Note: If you used client side required field validators with FTB...they will have to be changed to server side. (At least with version 2.3 or older...not sure about 3.0 yet)
  •  06-07-2004, 8:31 PM 955 in reply to 954

    Re: SaveAs and Open dialogs

    Hey B,

     
    Thanks for the note.  ((grin))  It did for me. =)  It was just an undocumented "feature" that I figured out how to do.  I posted how to do it, but he stopped sharing his control source not long after.
     
    So how do you like this compared to FTB?  Seems pretty similar, maybe even shared code path.  Is there a way to add customized dropdowns like the links, zoom, code snippet etc... or you mentioned buttons?  And can you rearrange the buttons or add just the ones you want?  I must admit I like the templates and code snippets insert things.
     
    Thanks for the pointers,
     
    -C
  •  06-09-2004, 9:56 AM 961 in reply to 955

    Re: SaveAs and Open dialogs

    CuteEditor is certainly a more complete control...is it better...I suppose that depends on how you define "better". I like it, and have not returned to FTB. CuteEditor offers improve table editing and support, better image support, and improved dropdown listbox support. Configuring the control is about the same as FTB...which is to say easy. The users also like the font coloring toolbar menu option...it does have good behavior, as well as emoticon support. Of course it has been more than 6 months since I have looked at FTB...things may have changed. And I know the ASP.NET Forum developers have integrated it into version 2.0 of that product...so maybe it is getting better.

     
    The CuteEditor menu bar can be customized just about anyway you want...I myself don't use any of the default configurations. I have also used custom buttons, but only to add NetSpell to the menu bar. I also use a custom styles dropdown....since we use it in the iBuySpy Portal, we have populated the dropdown with our CSS styles unique to the Portal...it works well. Sorry I took so long to respond...hope this helps a little...
  •  06-09-2004, 7:53 PM 981 in reply to 961

    Re: SaveAs and Open dialogs

    Hey B,

     
    Thanks much for the info.  I've just started looking at this software, so I may have missed this part.  I did a forum search, but I haven't seen any where where it explains how to insert a custom dropdown.  What's the trick?  Also it seems the page links to the faq on inserting a button are also not working, so any pointers, code etc...would be much appreciated for either.  One of the frustrations I had with FTB was the constant guessing, luckily I have been lucky at it, but it would be nice not to have to.
     
    So any pointers on:
     
    inserting buttons
    inserting dropdowns
    saving to a file
    opening from a file
     
    Would be much appreciated!
     
    I can already save and open to the database reusing my FTB code and I have added a custom buttom, but would like to know if the button will call javascript functions like FTB did or C# functions in my codebehind.
     
    Cheers and thanks,
     
    -Colin
  •  06-09-2004, 8:17 PM 982 in reply to 981

    Re: SaveAs and Open dialogs

    Colin,

     

    Inserting your custom buttons

     
    You can find the following code in the examples: addcustombuttons.aspx, addcustombuttons_vb.aspx.
     

    <script runat="server">

    void Page_Load(object sender, System.EventArgs e)

    {

        System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image ();

        Image1.ID = "Time"; // This ID will be used in template

        Image1.ToolTip = "Insert the current time";

        Image1.ImageUrl = "timer.gif";

        Image1.CssClass = "button";

        Image1.Attributes.Add("onclick","var d = new Date(); Paste_Html1('Editor1',d.toLocaleTimeString())");

        Image1.Attributes.Add("type","btn");

        Editor1.RegisterCustomButton(Image1);

    }

    </script>

     

    Inserting dropdowns

     
    You can find the following code in the examples: addcustombuttons.aspx, addcustombuttons_vb.aspx. 

    <script runat="server">

    void Page_Load(object sender, System.EventArgs e)

    {

        DropDownList tempDropDown = new DropDownList();

        tempDropDown.Attributes.Add("OnChange","Paste_Html1('Editor1',this[this.selectedIndex].value)");

        tempDropDown.Items.Add(new ListItem("Insert Html",""));

        tempDropDown.ID = "HTML";// This ID will be used in template

        tempDropDown.Items.Add(new ListItem("CuteSoft.net","<img src='/images/logo.gif'>"));

        tempDropDown.Items.Add(new ListItem("Asp.Net logo","<img src='/images/aspnet.gif'>"));

        tempDropDown.Attributes.Add("style","width:100; margin-left:5;font:8pt Verdana;vertical-align:middle;");

        Editor1.RegisterCustomButton(tempDropDown);

    }

    </script>

     

     

    Saving to a file and opening from a file

     
    You can find the following code in the examples: editHtml.aspx, editHtml_vb.aspx.
     

    <script runat="server">

    void Page_Load(object sender, System.EventArgs e)

    {

        if (IsPostBack)

        {

             // Save the content of the editor to a static html file
            Editor1.SaveFile("document.html");

            Literal1.Text = Server.HtmlEncode(Editor1.XHTML);

        }

        else

        {

            // Load the file to the editor
            Editor1.LoadHtml("document.html");

        }

    }

    </script>

     

     Hope it helps.


    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

  •  06-09-2004, 11:43 PM 983 in reply to 982

    Re: SaveAs and Open dialogs

    Hi Adam,

     
    Thanks very much for the snippets!  They'll help out alot, for some reason although most of the examples worked, the addcustombuttons.aspx that I got didn't work as I expected while running it in dreamweaver mx, so getting the snippets to verify helps out a lot.  
     
    Hey, is there any file size limit when creating or saving an html file using the editor?  I'm excited to start using this on our web site along with posting my review on it.  From what I've seen, I like it.
     
    Thanks again for your help,
     
    Cheers,
     
    -Colin
  •  06-09-2004, 11:51 PM 984 in reply to 983

    Re: SaveAs and Open dialogs

    Colin,

     
    You are welcome!
     
    We rewrote some examples recently. Please download the control again.  The addcustombuttons.aspx  file should work. Keep me posted.
     
    There is no file size limitation when create the files and save to files using the control.
     
    Good luck

    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

  •  06-11-2004, 12:19 AM 1001 in reply to 984

    Re: SaveAs and Open dialogs

    Downloaded the files again, thanks for the tip.
     
    Ok, I've added a dropdown etc... and populated it from my db.
     
    Is there a quick way to set the style so that the custom dropdownlist I added conforms with the style of the rest of the dropdownlists in the editor?  I'd like it to look like the code snippet dropdown, it currently looks like an ugly step child. =)
     
    I'll try a few things and wander through the help file etc..., but just in case you know off the top of your head.
     
    Cheers,
     
    -Colin
     
     
View as RSS news feed in XML