Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How Can I change ScriptManager with ToolkitScripManager?How Can I change ScriptManager with ToolkitScripManager?
Previous
 
Next
New Post
6/30/2009 2:26 AM
 

As you may now the new version of Ajax Control Toolkit has a new script manager that derrived from the officail ScripManager but combine all resulr scripts to one file and compress it with gzip that have a positive affect on performance (that I guess is of the every dnn's users  problems).

I try to change it with changeing the Ajax.vb file but it doesn't work. the changed file is below:

#Region "Private Methods"

        Private Shared Function ScriptManagerType() As Type
            If m_ScriptManagerType Is Nothing Then
                If Not m_Initialized Then
                    m_ScriptManagerType = Reflection.CreateType("AjaxControlToolkit.ToolkitScriptManager", True)
                End If
                m_Initialized = True
            End If
            Return m_ScriptManagerType
        End Function

        Private Shared Function UpdatePanelType() As Type
            If m_UpdatePanelType Is Nothing Then
                m_UpdatePanelType = Reflection.CreateType("System.Web.UI.UpdatePanel")
            End If
            Return m_UpdatePanelType
        End Function

        Private Shared Function UpdateProgressType() As Type
            If m_UpdateProgressType Is Nothing Then
                m_UpdateProgressType = Reflection.CreateType("System.Web.UI.UpdateProgress")
            End If
            Return m_UpdateProgressType
        End Function

        Private Shared Function UpdatePanelUpdateModeType() As Type
            If m_UpdatePanelUpdateModeType Is Nothing Then
                m_UpdatePanelUpdateModeType = Reflection.CreateType("System.Web.UI.UpdatePanelUpdateMode")
            End If
            Return m_UpdatePanelUpdateModeType
        End Function

#End Region

#Region "Public Methods"

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' IsHostEnabled is used to determine whether the Host user has enabled AJAX.
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function IsHostEnabled() As Boolean
            If Common.Globals.HostSettings.ContainsKey("EnableAJAX") Then
                If Common.Globals.HostSettings("EnableAJAX").ToString = "Y" Then
                    Return True
                Else
                    Return False
                End If
            Else
                Return True
            End If
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' IsEnabled can be used to determine if AJAX has been enabled already as we
        ''' only need one Script Manager per page.
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function IsEnabled() As Boolean
            If HttpContext.Current.Items("AjaxControlToolkit.ToolkitScriptManager") Is Nothing Then
                Return False
            Else
                Return CType(HttpContext.Current.Items("AjaxControlToolkit.ToolkitScriptManager"), Boolean)
            End If
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' IsInstalled can be used to determine if AJAX is installed on the server
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function IsInstalled() As Boolean
            'First check that the script module is installed
            Dim configDoc As XmlDocument = Config.Load()
            Dim moduleNavigator As XPathNavigator = configDoc.CreateNavigator.SelectSingleNode("/configuration/system.web/httpModules/add[@name='ScriptModule']")
            If moduleNavigator Is Nothing Then
                Return False
            Else
                Return Not ScriptManagerType() Is Nothing And IsHostEnabled()
            End If
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' RegisterScriptManager must be used by developers to instruct the framework that AJAX is required on the page
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Sub RegisterScriptManager()
            If Not IsEnabled() Then
                HttpContext.Current.Items.Add("AjaxControlToolkit.ToolkitScriptManager", True)
            End If
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' ScriptManagerControl provides a reference to the ScriptManager control on the page
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function ScriptManagerControl(ByVal objPage As Page) As Control
            Return objPage.FindControl("ScriptManager")
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' AddScriptManager is used internally by the framework to add a ScriptManager control to the page
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Sub AddScriptManager(ByVal objPage As Page)
            If IsInstalled() AndAlso objPage.FindControl("ScriptManager") Is Nothing Then
                Dim objScriptManager As Object = Reflection.CreateInstance(ScriptManagerType)
                Dim objControl As Control = CType(objScriptManager, Control)
                objControl.ID = "ScriptManager"
                Try
                    objPage.form.Controls.AddAt(0, objControl)
                Catch ex As Exception
                    ' ScriptManager can not be added to a page if running in Medium Trust and AJAX not installed in GAC
                    m_ScriptManagerType = Nothing
                End Try
            End If
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' RemoveScriptManager will remove the ScriptManager control during Page Render if the RegisterScriptManager has not been called
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Sub RemoveScriptManager(ByVal objPage As Page)
            If IsInstalled() = False Or IsEnabled() = False Then
                Dim objControl As Control = objPage.FindControl("ScriptManager")
                If Not objControl Is Nothing Then
                    objPage.form.Controls.Remove(objControl)
                End If
            End If
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' SetScriptManagerProperty uses reflection to set properties on the dynamically generated ScriptManager control
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Sub SetScriptManagerProperty(ByVal objPage As Page, ByVal PropertyName As String, ByVal Args() As Object)
            If Not ScriptManagerType() Is Nothing Then
                If Not ScriptManagerControl(objPage) Is Nothing Then
                    Reflection.SetProperty(ScriptManagerType, PropertyName, ScriptManagerControl(objPage), Args)
                End If
            End If
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' UpdatePanelControl dynamically creates an instance of an UpdatePanel control
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function CreateUpdatePanelControl() As Control
            Dim objCtl As Control = CType(Reflection.CreateInstance(UpdatePanelType), Control)
            Reflection.SetProperty(UpdatePanelType, "UpdateMode", objCtl, New Object() {System.Enum.Parse(UpdatePanelUpdateModeType, "1")})  'Conditional
            Return objCtl
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' Allows a control to be excluded from UpdatePanel async callback
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Sub RegisterPostBackControl(ByVal objControl As Control)
            If Not ScriptManagerType() Is Nothing Then
                If Not ScriptManagerControl(objControl.Page) Is Nothing Then
                    Reflection.InvokeMethod(ScriptManagerType, "RegisterPostBackControl", ScriptManagerControl(objControl.Page), New Object() {objControl})
                End If
            End If

        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' Wraps a control in an update panel
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function WrapUpdatePanelControl(ByVal objControl As Control, ByVal blnIncludeProgress As Boolean) As Control
            Dim objPanel As Control = CreateUpdatePanelControl()
            objPanel.ID = objControl.ID & "_UP"
            Dim objContentTemplateContainer As Control = AJAX.ContentTemplateContainerControl(objPanel)

            For i As Integer = 0 To objControl.Parent.Controls.Count - 1    'find offset of original control
                If objControl.Parent.Controls(i).ID = objControl.ID Then    'if ID matches
                    objControl.Parent.Controls.AddAt(i, objPanel)       'insert update panel in that position
                    objContentTemplateContainer.Controls.Add(objControl)    'inject passed in control into update panel
                    Exit For
                End If
            Next

            If blnIncludeProgress Then
                'create image for update progress control
                Dim objImage As System.Web.UI.WebControls.Image = New System.Web.UI.WebControls.Image()
                objImage.ImageUrl = "~/images/progressbar.gif"  'hardcoded
                objContentTemplateContainer.Controls.Add(AJAX.CreateUpdateProgressControl(objPanel.ID, objImage))
            End If

            Return objPanel
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' UpdateProgressControl dynamically creates an instance of an UpdateProgress control
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function CreateUpdateProgressControl(ByVal AssociatedUpdatePanelID As String) As Control
            Dim objCtl As Control = CType(Reflection.CreateInstance(UpdateProgressType), Control)
            objCtl.ID = AssociatedUpdatePanelID + "_Prog"
            Reflection.SetProperty(UpdateProgressType, "AssociatedUpdatePanelID", objCtl, New Object() {AssociatedUpdatePanelID})
            Return objCtl
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' UpdateProgressControl dynamically creates an instance of an UpdateProgress control
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function CreateUpdateProgressControl(ByVal AssociatedUpdatePanelID As String, ByVal ProgressHTML As String) As Control
            Dim objCtl As Control = CreateUpdateProgressControl(AssociatedUpdatePanelID)
            Reflection.SetProperty(UpdateProgressType, "ProgressTemplate", objCtl, New Object() {New UI.WebControls.LiteralTemplate(ProgressHTML)})
            Return objCtl
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' UpdateProgressControl dynamically creates an instance of an UpdateProgress control
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function CreateUpdateProgressControl(ByVal AssociatedUpdatePanelID As String, ByVal ProgressControl As Control) As Control
            Dim objCtl As Control = CreateUpdateProgressControl(AssociatedUpdatePanelID)
            Reflection.SetProperty(UpdateProgressType, "ProgressTemplate", objCtl, New Object() {New UI.WebControls.LiteralTemplate(ProgressControl)})
            Return objCtl
        End Function

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' ContentTemplateContainerControl gets a reference to the ContentTemplateContainer control within an UpdatePanel
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Shared Function ContentTemplateContainerControl(ByVal objUpdatePanel As Object) As Control
            Return CType(Reflection.GetProperty(UpdatePanelType, "ContentTemplateContainer", objUpdatePanel), Control)
        End Function

#End Region

 

So what's the solution?

thanks in advance

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How Can I change ScriptManager with ToolkitScripManager?How Can I change ScriptManager with ToolkitScripManager?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out