Re: How to get started with Cute Editor

  •  11-03-2008, 1:40 AM

    Re: How to get started with Cute Editor

    Hi Bod,
     
    Here is the code in VB:
     

    <%@ Page Language="VB" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
        Private Function GetSavedValue() As String
            Dim obj As Object = Application("myvalue")
            If obj IsNot Nothing Then
                Return obj.ToString()
            End If
            Return "Click here to edit the news !"
        End Function
        Private Sub SaveValue(ByVal val As String)
            Application("myvalue") = val
        End Sub

        Protected Overloads Overrides Sub OnLoad(ByVal e As EventArgs)
            MyBase.OnLoad(e)
       
            If Not IsPostBack Then
                Dim val As String = GetSavedValue()
                MyContent.Text = GetSavedValue()
           
               
               
                Editor1.Text = val
            End If
        End Sub

        Protected Sub Editor1_PostBackCommand(ByVal sender As Object, ByVal e As CommandEventArgs)
            If e.CommandName = "Save" Then
           
                SaveValue(Editor1.Text)
               
                MyContent.Text = Editor1.Text
            End If
        End Sub


    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div id="divedit" style="display: none; position: absolute; left: 0px; top: 0px;
                width: 100%; height: 100%; text-align: center; background-color: White; padding-top: 100px;">
                <div>
                    Click save button to save the news...</div>
                <CE:Editor ID="Editor1" runat="server" OnPostBackCommand="Editor1_PostBackCommand">
                </CE:Editor>
            </div>
            <div style="border: solid 1px gray; padding: 12px; margin: 12px;" onclick="showEditor()">
                <asp:Literal ID="MyContent" runat="server"></asp:Literal>
            </div>
        </form>

        <script>
        var haspermossion=true;
        function showEditor()
        {
            if(haspermossion)
            {
                document.getElementById("divedit").style.display="";
            }
        }
        </script>

    </body>
    </html>
     
    Regards,
     
    Ken
View Complete Thread