How to Render Javascripts-Collects?

Last post 11-17-2004, 10:36 PM by RyanLiu. 1 replies.
Sort Posts: Previous Next
  •  11-17-2004, 1:56 AM 2460

    How to Render Javascripts-Collects?

    A Nice WebEditor!

     
    When I use your Webeditor in multipleeditors mode,
     
    I found what the output include some Javascript code. samelike:
     

    <script language="javascript" type="text/javascript">
    <!--
     var g_state =  new Array(new _CState('Editor1','zh-CN','/ASP.NETv1.1/Uploads','/ASP.NETv1.1/CuteEditor_Files',100,80,80,5,4,'True','True','/ASP.NETv1.1/Uploads',100,'/ASP.NETv1.1/Uploads',100,'False','div','#efefef',640,640,'True','True','/ASP.NETv1.1/Uploads',100), new _CState('Editor2','zh-CN','/ASP.NETv1.1/Uploads','/ASP.NETv1.1/CuteEditor_Files',100,80,80,5,4,'True','True','/ASP.NETv1.1/Uploads',100,'/ASP.NETv1.1/Uploads',100,'False','div','#efefef',640,640,'True','True','/ASP.NETv1.1/Uploads',100));
      // -->
    </script>

       
        <script language="javascript">    
        var editing; 
        for (var i = 0; i < g_state.length; i ++)
         g_state[i].Load();
        var submit_data = document.getElementById('_ctl0').submit;
        document.getElementById('_ctl0').submit = function() {
         for (var i = 0; i < g_state.length; i ++)
          save(g_state[i].UniqueID);
         submit_data();
        }   
       </script>
     
    One webeditor output one "new _CState()"  , but how can I output one  "new _CState()"  in multiple editors When I design my control,just like above?
    thanks
     
  •  11-17-2004, 10:36 PM 2469 in reply to 2460

    Re: How to Render Javascripts-Collects?

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

                'Store Every-Editor Settings to PageSession

                myUniqueId = Me.UniqueID
                Dim EditorFooterJs As String = Page.Session("CuteEditorScritps")
                Dim EditorScripts As String
                EditorScripts += "new _CState('" + myUniqueId + "'"
                EditorScripts += ",'" + UICulture + "'"
                EditorScripts += ",'" + ImageGalleryPath + "'"
    ???
                EditorScripts += "," + MaxMediaSize.ToString + ")"
                If EditorFooterJs <> "" Then
                    EditorFooterJs += ","
                End If
                EditorFooterJs += EditorScripts
                Page.Session("CuteEditorScritps") = EditorFooterJs
    end sub
     

    Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
                If Not Page.IsStartupScriptRegistered("EditorFooterJs") Then

                    Dim EditorScripts As String
                    EditorScripts = "<scr" + "ipt language=""javascr" + "ipt"" type=""text/javasc" + "ript"">" & vbCrLf
                    EditorScripts += "var g_state =  new Array("

                    'Output Settings From page Session, at last Editor render. and set page session null
                    EditorScripts += Page.Session("CuteEditorScritps")
                    Page.Session("CuteEditorScritps") = ""

                    EditorScripts += ");" & vbCrLf
                    EditorScripts += "</script>" & vbCrLf

                    Page.RegisterStartupScript("EditorFooterJs", EditorScripts)

                End If
    End Sub
    Use page session ,not so good.
View as RSS news feed in XML