How do you get the editor in an existing textarea

Last post 03-23-2005, 7:16 PM by desman. 5 replies.
Sort Posts: Previous Next
  •  03-23-2005, 2:05 AM 4900

    How do you get the editor in an existing textarea

    Hi,
    Sorry, I posted the in the version 3 should have been here.

    As the topic says, I have an existing textarea is there a javascript call or another way.
     
    My textarea form is: <asp:TextBox id="demoEditor1"   CssClass="ClearTextarea" Columns="50" Rows="3" TextMode="MultiLine" runat="server"/>
     
    Help
  •  03-23-2005, 2:16 AM 4901 in reply to 4900

    Re: How do you get the editor in an existing textarea

    Please follow these steps: 
     
    1.deploying the CuteEditor.dll assembly and license file

    Copy the CuteEditor.dll and the CuteEditor.lic to the \bin directory for the web application that uses the CuteEditor. 

    If you need the spell checker function, you need to copy the NetSpell.SpellChecker.dll and the dictionaries files to the \bin directory as well.

    Then modify your web.config file and specify the NetSpell dictionary folder:

    <appSettings>
        <add key="DictionaryFolder" value="bin"/>
    </appSettings>



    2. Deploying the CuteEditor Client files

    The "CuteSoft_Client/CuteEditor" folder and all file it contains (you can find in the download package) should be deployed to http://{your site}/{your application}/CuteSoft_Client/CuteEditor/ on your web site.

    If you want to deploy the CuteEditor Client file to a different location, you will have to make sure that you set your editor FilesPath property correctly. The control expects to find the all the files and images in the files directory specified by the control FilesPath property.
     
    3. Open your existing ASPX page. 

    Add the CuteEditor Register directive at the top:

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    4. Add the CuteEditor tags in the body of the WebForm:

       Replace the textbox:

       <asp:TextBox id="DesktopText" columns="75" width="650" rows="12" textmode="multiline" runat="server" />

       With CuteEditor:                                            

      <CE:Editor id="DesktopText " runat="server"></CE:Editor>

     



    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

  •  03-23-2005, 5:37 AM 4902 in reply to 4901

    Re: How do you get the editor in an existing textarea

    When I replace the textbox with I receive errors: Parser Error Message: The base class includes the field 'demoEditor1', but its type (System.Web.UI.WebControls.TextBox) is not compatible with the type of control (CuteEditor.Editor).
    Help
  •  03-23-2005, 9:49 AM 4908 in reply to 4902

    Re: How do you get the editor in an existing textarea

  •  03-23-2005, 5:37 PM 4924 in reply to 4908

    Re: How do you get the editor in an existing textarea

    I have changed the control name to Editor1, and here is the code behind:
     
    'Using Statements @1-E5FBC350
    Imports System
    Imports System.Collections
    Imports System.Collections.Specialized
    Imports System.ComponentModel
    Imports System.Data
    Imports System.Drawing
    Imports System.Web
    Imports System.Web.SessionState
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Web.UI.HtmlControls
    Imports System.Text.RegularExpressions
    Imports System.Globalization
    Imports NewProject1
    Imports NewProject1.Data
    Imports NewProject1.Security
    Imports NewProject1.Configuration
    Imports NewProject1.Controls
    Namespace Yes [Y]
    'End Using Statements
    'Forms Definition @1-A03C6C47
    Public Class [yPage]
    Inherits System.Web.UI.Page
    'End Forms Definition
    'Forms Objects @1-EBD5F1A0
        Protected editor1Data As editor1DataProvider
        Protected editor1Error As System.Web.UI.WebControls.PlaceHolder
        Protected editor1Holder As System.Web.UI.HtmlControls.HtmlControl
        Protected editor1ErrorLabel As System.Web.UI.WebControls.Label
        Protected editor1Errors As NameValueCollection = New NameValueCollection()
        Protected editor1Operations As FormSupportedOperations
        Protected editor1Name As System.Web.UI.WebControls.TextBox
        Protected editor1Editor1 As System.Web.UI.WebControls.TextBox
        Dim Protected editor1Button_Insert As HtmlInputButton
        Dim Protected editor1Button_Update As HtmlInputButton
        Dim Protected editor1Button_Delete As HtmlInputButton
    'End Forms Objects
    'Page_Load Event @1-A2D2CF1E
    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    'End Page_Load Event
    'Page_Load Event BeforeIsPostBack @1-49DCD044
        If Not IsPostBack Then
                Dim PageData As PageDataProvider = New PageDataProvider()
                Dim item As PageItem = PageItem.CreateFromHttpRequest()
                PageData.FillItem(item)
                editor1Show()
        End If
    'End Page_Load Event BeforeIsPostBack
    'Page_Load Event tail @1-E31F8E2A
    End Sub
    'End Page_Load Event tail
    'Page_Unload Event @1-D998A98F
    Protected Overrides Sub OnUnload(ByVal e As System.EventArgs)
    'End Page_Unload Event
    'Page_Unload Event tail @1-E31F8E2A
    End Sub
    'End Page_Unload Event tail
    'Record Form editor1 Parameters @2-FC249DD2
        Protected Sub editor1Parameters()
            Try
                editor1Data.UrlDesignetID = IntegerParameter.GetParam(Request.QueryString("DesignetID"))
            Catch e As Exception
                editor1Errors.Add("Parameters","Form Parameters: " + e.Message)
            End Try
        End Sub
    'End Record Form editor1 Parameters
    'Record Form editor1 Show method @2-E40B16BD
        Protected Sub editor1Show()
            If editor1Operations.None Then
                editor1Holder.Visible = False
                Return
            End If
            Dim item As editor1Item = editor1Item.CreateFromHttpRequest()
            Dim IsInsertMode As Boolean = Not editor1Operations.AllowRead
            editor1Errors.Add(item.errors)
            If editor1Errors.Count > 0 Then
                editor1ShowErrors()
                Return
            End If
    'End Record Form editor1 Show method
    'Record Form editor1 BeforeShow tail @2-AA7B3AEB
            editor1Parameters()
            editor1Data.FillItem(item, IsInsertMode)
            editor1Button_Insert.Visible=IsInsertMode AndAlso editor1Operations.AllowInsert
            editor1Button_Update.Visible=Not(IsInsertMode) AndAlso editor1Operations.AllowUpdate
            editor1Button_Delete.Visible=Not(IsInsertMode) AndAlso editor1Operations.AllowDelete
            editor1Name.Text=item.Name.GetFormattedValue()
            editor1Editor1.Text=item.Editor1.GetFormattedValue()
    'End Record Form editor1 BeforeShow tail
    'Record Form editor1 Show method tail @2-887627E0
            If editor1Errors.Count > 0 Then
                editor1ShowErrors()
            End If
        End Sub
    'End Record Form editor1 Show method tail
    'Record Form editor1 LoadItemFromRequest method @2-4E87066F
        Protected Sub editor1LoadItemFromRequest(item As editor1Item, ByVal EnableValidation As Boolean)
            item.Name.SetValue(editor1Name.Text)
            item.Editor1.SetValue(editor1Editor1.Text)
            If EnableValidation Then
                item.Validate(editor1Data)
            End If
            editor1Errors.Add(item.errors)
        End Sub
    'End Record Form editor1 LoadItemFromRequest method
    'Record Form editor1 GetRedirectUrl method @2-91CCBCDA
        Protected Function Geteditor1RedirectUrl(ByVal redirect As String, ByVal removeList As String) As String
            Dim parameters As New LinkParameterCollection()
            If redirect = "" Then redirect = "y.aspx"
            Return redirect + "?" + parameters.ToString("GET",removeList,ViewState)
        End Function
    'End Record Form editor1 GetRedirectUrl method
    'Record Form editor1 ShowErrors method @2-F6F912B6
        Protected Sub editor1ShowErrors()
            Dim DefaultMessage As String = ""
            Dim i As Integer
            For i = 0 To editor1Errors.Count - 1
            Select Case editor1Errors.AllKeys(i)
                Case Else
                    DefaultMessage = DefaultMessage & editor1Errors(i) & "<br>"
            End Select
            Next i
            editor1Error.Visible = True
            editor1ErrorLabel.Text = DefaultMessage
        End Sub
    'End Record Form editor1 ShowErrors method
    'Record Form editor1 Insert Operation @2-198BBB74
        Protected Sub editor1_Insert(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim item As editor1Item = New editor1Item()
            Dim ExecuteFlag As Boolean = True
            Dim ErrorFlag As Boolean = False
            Dim RedirectUrl As String = ""
            Dim EnableValidation As Boolean = False
    'End Record Form editor1 Insert Operation
    'Button Button_Insert OnClick. @3-B08F0301
            If CType(sender,Control).ID = "editor1Button_Insert" Then
                RedirectUrl = Geteditor1RedirectUrl("", "")
                EnableValidation  = True
    'End Button Button_Insert OnClick.
    'Button Button_Insert OnClick tail. @3-477CF3C9
            End If
    'End Button Button_Insert OnClick tail.
    'Record Form editor1 BeforeInsert tail @2-1E69A02A
        editor1Parameters()
        editor1LoadItemFromRequest(item, EnableValidation)
        If editor1Operations.AllowInsert Then
            ErrorFlag=(editor1Errors.Count > 0)
            If ExecuteFlag And (Not ErrorFlag) Then
                Try
                    editor1Data.InsertItem(item)
                Catch ex As Exception
                    editor1Errors.Add("DataProvider",ex.Message)
                    ErrorFlag = True
                End Try
            End If
    'End Record Form editor1 BeforeInsert tail
    'Record Form editor1 AfterInsert tail  @2-7269FD99
            End If
            If ErrorFlag Then
                editor1ShowErrors()
            Else
                Response.Redirect(RedirectUrl)
            End If
        End Sub
    'End Record Form editor1 AfterInsert tail
    'Record Form editor1 Update Operation @2-CD608DE1
        Protected Sub editor1_Update(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim item As editor1Item = New editor1Item()
            item.IsNew = False
            Dim ExecuteFlag As Boolean = True
            Dim ErrorFlag As Boolean = False
            Dim RedirectUrl As String = ""
            Dim EnableValidation As Boolean = False
    'End Record Form editor1 Update Operation
    'Button Button_Update OnClick. @4-7DB23FCA
            If CType(sender,Control).ID = "editor1Button_Update" Then
                RedirectUrl = Geteditor1RedirectUrl("", "")
                EnableValidation  = True
    'End Button Button_Update OnClick.
    'Button Button_Update OnClick tail. @4-477CF3C9
            End If
    'End Button Button_Update OnClick tail.
    'Record Form editor1 Before Update tail @2-3D5C7F61
            editor1Parameters()
            editor1LoadItemFromRequest(item, EnableValidation)
            If editor1Operations.AllowUpdate Then
            ErrorFlag = (editor1Errors.Count > 0)
            If ExecuteFlag And (Not ErrorFlag) Then
                Try
                    editor1Data.UpdateItem(item)
                Catch ex As Exception
                    editor1Errors.Add("DataProvider",ex.Message)
                    ErrorFlag = True
                End Try
            End If
    'End Record Form editor1 Before Update tail
    'Record Form editor1 Update Operation tail @2-7269FD99
            End If
            If ErrorFlag Then
                editor1ShowErrors()
            Else
                Response.Redirect(RedirectUrl)
            End If
        End Sub
    'End Record Form editor1 Update Operation tail
    'Record Form editor1 Delete Operation @2-A7DD2D20
        Protected Sub editor1_Delete(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim ExecuteFlag As Boolean = True
            Dim ErrorFlag As Boolean = False
            Dim RedirectUrl As String = ""
            Dim EnableValidation As Boolean = False
            Dim item As editor1Item = New editor1Item()
            item.IsNew  = False
            item.IsDeleted  = True
    'End Record Form editor1 Delete Operation
    'Button Button_Delete OnClick. @5-0A395CF6
            If CType(sender,Control).ID = "editor1Button_Delete" Then
                RedirectUrl = Geteditor1RedirectUrl("", "")
                EnableValidation  = False
    'End Button Button_Delete OnClick.
    'Button Button_Delete OnClick tail. @5-477CF3C9
            End If
    'End Button Button_Delete OnClick tail.
    'Record Form BeforeDelete tail @2-2D3C6FAC
            editor1Parameters()
            editor1LoadItemFromRequest(item, EnableValidation)
            If editor1Operations.AllowDelete Then
            ErrorFlag = (editor1Errors.Count > 0)
            If ExecuteFlag And (Not ErrorFlag) Then
                Try
                    editor1Data.DeleteItem(item)
                Catch ex As Exception
                    editor1Errors.Add("DataProvider",ex.Message)
                    ErrorFlag = True
                End Try
            End If
    'End Record Form BeforeDelete tail
    'Record Form AfterDelete tail @2-7269FD99
            End If
            If ErrorFlag Then
                editor1ShowErrors()
            Else
                Response.Redirect(RedirectUrl)
            End If
        End Sub
    'End Record Form AfterDelete tail
    'Record Form editor1 Cancel Operation @2-B630D1BA
        Protected Sub editor1_Cancel(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim item As editor1Item = New editor1Item()
            Dim RedirectUrl As String = ""
            editor1LoadItemFromRequest(item, True)
    'End Record Form editor1 Cancel Operation
    'Record Form editor1 Cancel Operation tail @2-EA2B0FFB
            Response.Redirect(RedirectUrl)
        End Sub
    'End Record Form editor1 Cancel Operation tail
    'OnInit Event @1-3349F5FF
        #Region " Web Form Designer Generated Code "
        Protected Overrides Sub OnInit(ByVal e As EventArgs)
            '
            ' CODEGEN: This call is required by the ASP.NET Web Form Designer.
            '
            InitializeComponent()
            'Me.Load += new System.EventHandler(this.Page_Load);
            'Me.Unload += new System.EventHandler(this.Page_Unload);
            MyBase.OnInit(e)
            editor1Data = New editor1DataProvider()
            editor1Operations = New FormSupportedOperations(False, True, True, True, True)
    'End OnInit Event
    'OnInit Event tail @1-E31F8E2A
        End Sub
    'End OnInit Event tail
    'InitializeComponent Event @1-EA5E2628
        ' <summary>
        ' Required method for Designer support - do not modify
        ' the contents of this method with the code editor.
        ' </summary>
        Private Sub InitializeComponent()
        End Sub
        #End Region
    'End InitializeComponent Event
    'Page class tail @1-DD082417
    End Class
    End Namespace
    'End Page class tail
  •  03-23-2005, 7:16 PM 4925 in reply to 4924

    Re: How do you get the editor in an existing textarea

    Hi all,
     
    I have this working - Thanks for your help.
     
    Cheers, Desman
View as RSS news feed in XML