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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Error: Sys.InvalidOperationException: A control is already associated with the element.Error: Sys.InvalidOperationException: A control is already associated with the element.
Previous
 
Next
New Post
10/18/2011 4:32 AM
 
Maybe problem is here: you have assigned the DatasourceID "SqlDataSource1" twice to the Grid and its MasterTableView, try to remove the later one.

NovaSoftware ---a professional outsourcing company in China .
* More than 6 years' offshore experience in DNN
* Successfully developed 30+ websites , 250+ DNN modules, 50+ sets of Skins/Containers.
* Demo Site:http://dotnetnuke.novasoftware.com/
 
New Post
10/18/2011 10:10 AM
 
I tried removing the datasource(both are added via the GUI for the Telerik Grid control when specifiy the datasource from a drop down) this did not fix it and removing the first one broke it. Thanks though.

Thank you,
James Campbell
MCP,MCSA,MCSE,Sec +
http://jamesecampbell.blogspot.com
 
New Post
10/20/2011 12:50 PM
Accepted Answer 

I believe I have come up with a solution to the issue. I made the following change to the DNN core 5.6.3. In the DotNetNuke.Library project. I recompiled and imported my newly created DLL into my project.

I changed line 46 to read:

Using objScriptManager As Telerik.Web.UI.RadScriptManager = New Telerik.Web.UI.RadScriptManager() With {.ID = "ScriptManager", .EnableScriptGlobalization = True}

The whole file now looks like this:

'
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2010
' by DotNetNuke Corporation
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
'
 
Imports System.Web.Compilation
Imports System.Reflection
Imports System.Xml
Imports System.Xml.XPath
Imports DotNetNuke.Entities.Host
 
Namespace DotNetNuke.Framework
 
    Public Class AJAX
 
#Region "Public Methods"
 
        ''' -----------------------------------------------------------------------------
        ''' <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 GetScriptManager(objPage) Is Nothing Then
        Using objScriptManager As Telerik.Web.UI.RadScriptManager = New Telerik.Web.UI.RadScriptManager() With {.ID = "ScriptManager", .EnableScriptGlobalization = True}
          If objPage.Form IsNot Nothing Then
            Try
              objPage.Form.Controls.AddAt(0, objScriptManager)
            Catch ex As HttpException
              'suppress error adding script manager to support edge-case of module developers custom aspx pages that inherit from basepage and use code blocks
            End Try
            If HttpContext.Current.Items("System.Web.UI.ScriptManager") Is Nothing Then
              HttpContext.Current.Items.Add("System.Web.UI.ScriptManager", True)
            End If
          End If
        End Using
            End If
        End Sub
 
        Public Shared Function GetScriptManager(ByVal objPage As Page) As ScriptManager
            Return TryCast(objPage.FindControl("ScriptManager"), ScriptManager)
        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("System.Web.UI.ScriptManager") Is Nothing Then
                Return False
            Else
                Return CType(HttpContext.Current.Items("System.Web.UI.ScriptManager"), 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
            Return True
        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)
            Dim objScriptManager As ScriptManager = GetScriptManager(objControl.Page)
            If objScriptManager IsNot Nothing Then
                objScriptManager.RegisterPostBackControl(objControl)
            End If
        End Sub
 
        ''' -----------------------------------------------------------------------------
        ''' <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("System.Web.UI.ScriptManager", True)
            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 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>
        ''' 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 updatePanel As New UpdatePanel()
            updatePanel.ID = objControl.ID & "_UP"
            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional
 
            Dim objContentTemplateContainer As Control = updatePanel.ContentTemplateContainer
 
            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, updatePanel)       '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
                objImage.AlternateText = "ProgressBar"
 
                Dim updateProgress As New UpdateProgress
                updateProgress.AssociatedUpdatePanelID = updatePanel.ID
                updateProgress.ID = updatePanel.ID + "_Prog"
                updateProgress.ProgressTemplate = New UI.WebControls.LiteralTemplate(objImage)
 
                objContentTemplateContainer.Controls.Add(updateProgress)
            End If
 
            Return updatePanel
        End Function
 
#End Region
 
#Region "Obsolete Methods"
 
        <Obsolete("Deprecated in DNN 5.4, Developers can work directly with the UpdatePanel")> _
        Public Shared Function ContentTemplateContainerControl(ByVal objUpdatePanel As Object) As Control
            Return TryCast(objUpdatePanel, UpdatePanel).ContentTemplateContainer
        End Function
 
        <Obsolete("Deprecated in DNN 5.4, MS AJax is now required for DotNetNuke 5.0.  Develoers can create the control directly")> _
        Public Shared Function CreateUpdatePanelControl() As Control
            Dim updatePanel As New UpdatePanel()
            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional
            Return updatePanel
        End Function
 
        <Obsolete("Deprecated in DNN 5.4, MS AJax is now required for DotNetNuke 5.0. Developers can work directly with the UpdateProgress")> _
        Public Shared Function CreateUpdateProgressControl(ByVal AssociatedUpdatePanelID As String) As Control
            Dim updateProgress As New UpdateProgress
            updateProgress.ID = AssociatedUpdatePanelID + "_Prog"
            updateProgress.AssociatedUpdatePanelID = AssociatedUpdatePanelID
            Return updateProgress
        End Function
 
        <Obsolete("Deprecated in DNN 5.4, MS AJax is now required for DotNetNuke 5.0. Developers can work directly with the UpdateProgress")> _
        Public Shared Function CreateUpdateProgressControl(ByVal AssociatedUpdatePanelID As String, ByVal ProgressHTML As String) As Control
            Dim updateProgress As New UpdateProgress
            updateProgress.ID = AssociatedUpdatePanelID + "_Prog"
            updateProgress.AssociatedUpdatePanelID = AssociatedUpdatePanelID
            updateProgress.ProgressTemplate = New UI.WebControls.LiteralTemplate(ProgressHTML)
            Return updateProgress
        End Function
 
        <Obsolete("Deprecated in DNN 5.4, MS AJax is now required for DotNetNuke 5.0. Developers can work directly with the UpdateProgress")> _
        Public Shared Function CreateUpdateProgressControl(ByVal AssociatedUpdatePanelID As String, ByVal ProgressControl As Control) As Control
            Dim updateProgress As New UpdateProgress
            updateProgress.ID = AssociatedUpdatePanelID + "_Prog"
            updateProgress.AssociatedUpdatePanelID = AssociatedUpdatePanelID
            updateProgress.ProgressTemplate = New UI.WebControls.LiteralTemplate(ProgressControl)
            Return updateProgress
        End Function
 
        <Obsolete("Deprecated in DNN 5.0, MS AJax is now required for DotNetNuke 5.0 and above - value no longer read from Host.EnableAjax")> _
        Public Shared Function IsHostEnabled() As Boolean
            Return True
        End Function
 
        <Obsolete("Deprecated in DNN 5.4, Replaced by GetScriptManager")> _
        Public Shared Function ScriptManagerControl(ByVal objPage As Page) As Control
            Return objPage.FindControl("ScriptManager")
        End Function
 
        <Obsolete("Deprecated in DNN 5.4, Developers can work directly with the ScriptManager")> _
        Public Shared Sub SetScriptManagerProperty(ByVal objPage As Page, ByVal PropertyName As String, ByVal Args() As Object)
            Dim scriptManager As ScriptManager = GetScriptManager(objPage)
            If scriptManager IsNot Nothing Then
                Reflection.SetProperty(scriptManager.GetType(), PropertyName, scriptManager, Args)
            End If
        End Sub
 
#End Region
 
    End Class
End Namespace


Thank you,
James Campbell
MCP,MCSA,MCSE,Sec +
http://jamesecampbell.blogspot.com
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Error: Sys.InvalidOperationException: A control is already associated with the element.Error: Sys.InvalidOperationException: A control is already associated with the element.


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