Re: How to Render Javascripts-Collects?

  •  11-17-2004, 10:36 PM

    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 Complete Thread