FreeTextBox

The no. 1 free ASP.NET HTML Editor.
Welcome to FreeTextBox Sign in | Join | Help
in Search

Newbie Answered: How to load html into your FTB and save it afterwards - a lesson in perseverence

Last post 07-02-2008, 4:26 PM by Ross Holland. 0 replies.
Sort Posts: Previous Next
  •  07-02-2008, 4:26 PM 9260

    Newbie Answered: How to load html into your FTB and save it afterwards - a lesson in perseverence

    I have spent the last 3 evenings, and considerable brain cells, just trying to find an answer on how to do this, which is pretty basic (and other Rich Text Editors I have tried have a pre-built command for), and was seriously considering giving up and going elsewhere when I found this post

    http://freetextbox.com/forums/9259/ShowThread.aspx#9259

    I cut and pasted it into my page, changed a couple of the names, and hey presto! The images aren't showing yet, but I have seen numerous posts about this during my circulations around this site so I am sure I will be able to sort that one too.

    Also I am using Master Pages, which I see some have problems with. I attach the entire code here so any others can find it too. Note: this particular implementation of FTB is a read only version of the HTML file for the public to view.

    <%@ Page Language="VB" masterpagefile="MySite.master" title="My Site" %>
    <%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
    <%@ Import Namespace="System.IO" %>

    <script runat="server">
     Public Sub Page_Load(sender As object, e As System.EventArgs)
      If not IsPostBack Then
       ReadFile()
      End If
     End Sub
     
     Private Sub ReadFile()
      Dim reader1 As New StreamReader(Server.MapPath(Request.QueryString("DocID")))
      Dim text1 As String = reader1.ReadToEnd
      reader1.Close
      FreeTextBox1.Text = text1
     End Sub


    ' This next sub is for saving, which I assume runs as the OnSave event of the FTB
    ' Private Sub WriteFile()
    '  Dim writer1 As New StreamWriter(Me.sFile)
    '  writer1.WriteLine(FreeTextBox1.Text)
    '  writer1.Close
    ' End Sub
    </script>
    <asp:Content id="Content3" runat="server" contentplaceholderid="PageHeader">
    <div class="style3">
     <asp:Label runat="server" Text="Newsletter" id="PageLabel" Font-Underline="True">
     </asp:Label>
    </div>
    </asp:Content>

     

    <asp:Content id="Content1" runat="server" contentplaceholderid="head">
    </asp:Content>

     


    <asp:Content id="Content4" runat="server" contentplaceholderid="PageBody">
     <div class="style4">
      <FTB:FreeTextBox id="FreeTextBox1" runat="Server"
      ReadOnly="true" EnableHtmlMode="false" Focus="true" Width="850" AutoHideToolbar="true"
      ToolbarLayout=""
      />
     </div>
    </asp:Content>

     

View as RSS news feed in XML
www.freetextbox.com