Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6726845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:58:37+00:00 2026-05-26T09:58:37+00:00

sys.invalidoperationexception: A control is already associated with the element. I am using DotNetNuke 5.6.3.

  • 0

sys.invalidoperationexception: A control is already associated with the element. I am using DotNetNuke 5.6.3. The rror occurs if I click edit. I know it has something to do with AJAX, and the script manager, but I just cannot get it to function without this error in DotNetNeukt.

Here is my code:

<%@ Control language="C#" Inherits="my.Modules.ImageRotator.EditImageRotator" CodeFile="EditImageRotator.ascx.cs" AutoEventWireup="true"%>
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
<%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx" %>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>



<ContentTemplate>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" 
      AllowSorting="True" AutoGenerateDeleteColumn="True" 
      AutoGenerateEditColumn="True" CausesValidation="False" CellSpacing="0" 
      DataSourceID="SqlDataSource1" GridLines="None" RegisterWithScriptManager="true" 
      Skin="WebBlue">
      <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
        <Selecting AllowRowSelect="True" />
      </ClientSettings>
      <MasterTableView AutoGenerateColumns="False" DataKeyNames="ItemID" 
        DataSourceID="SqlDataSource1">
        <CommandItemSettings ExportToPdfText="Export to PDF" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
        </ExpandCollapseColumn>
        <Columns>
          <telerik:GridBoundColumn DataField="ModuleID" DataType="System.Int32" 
            FilterControlAltText="Filter ModuleID column" HeaderText="ModuleID" 
            SortExpression="ModuleID" UniqueName="ModuleID">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="ItemID" DataType="System.Int32" 
            FilterControlAltText="Filter ItemID column" HeaderText="ItemID" ReadOnly="True" 
            SortExpression="ItemID" UniqueName="ItemID">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="Content" 
            FilterControlAltText="Filter Content column" HeaderText="Content" 
            SortExpression="Content" UniqueName="Content">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="CreatedByUser" DataType="System.Int32" 
            FilterControlAltText="Filter CreatedByUser column" HeaderText="CreatedByUser" 
            SortExpression="CreatedByUser" UniqueName="CreatedByUser">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="CreatedDate" DataType="System.DateTime" 
            FilterControlAltText="Filter CreatedDate column" HeaderText="CreatedDate" 
            SortExpression="CreatedDate" UniqueName="CreatedDate">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="Link" 
            FilterControlAltText="Filter Link column" HeaderText="Link" 
            SortExpression="Link" UniqueName="Link">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="SortOrder" DataType="System.Int32" 
            FilterControlAltText="Filter SortOrder column" HeaderText="SortOrder" 
            SortExpression="SortOrder" UniqueName="SortOrder">
          </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
          <EditColumn FilterControlAltText="Filter EditCommandColumn column">
          </EditColumn>
        </EditFormSettings>
      </MasterTableView>
      <FilterMenu EnableImageSprites="False">
      </FilterMenu>
      <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
      </HeaderContextMenu>
    </telerik:RadGrid>
     </ContentTemplate>
     <br />
      <asp:linkbutton cssclass="CommandButton" id="cmdUpdate" OnClick="cmdUpdate_Click" resourcekey="cmdUpdate" runat="server" borderstyle="none" text="Update" CausesValidation="False"></asp:linkbutton>&nbsp;
    <asp:linkbutton cssclass="CommandButton" id="cmdCancel" OnClick="cmdCancel_Click" resourcekey="cmdCancel" runat="server" borderstyle="none" text="Cancel" causesvalidation="False"></asp:linkbutton>&nbsp;
    <asp:linkbutton cssclass="CommandButton" id="cmdDelete" OnClick="cmdDelete_Click" resourcekey="cmdDelete" runat="server" borderstyle="none" text="Delete" causesvalidation="False"></asp:linkbutton>&nbsp;
</div>

    <dnn:audit id="ctlAudit" runat="server" />

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
           ConnectionString="<%$ ConnectionStrings:ImageRotatorConnectionString %>" 
           SelectCommand="SELECT * FROM [ImageRotator]"></asp:SqlDataSource>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:58:38+00:00Added an answer on May 26, 2026 at 9:58 am

    OK, here is the solution. I needed to replace the default script manager. In the DNN core 5.6.3 in the DotNetNuke.Library projet, I made the following change to AJAX.VB :

    at line 46:

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

    The whole file now looks like this, once I completed the edit I recompiled and added my new dll to my project:

    '
    ' 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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that sys schema has execute access on all extended stored procedures. If
I'm collecting metadata using the sys.* views, and according to the documentation, the sys.identity_columns
SQL Server 2005 has great sys.XXX views on the system catalog which I use
My sys admin has me working on a server with Plesk, which requires me
I want something like sys.builtin_module_names except for the standard library. Other things that didn't
Using sys.dm_os_wait_stats I have identified what I believe is a locking problem wait type
I am currently using sys.syscomments to locate objects where a certain parameter exists. Is
I know now we cant use sys.exit() . So how do I exit in
I'm using the sys.dm_tran_locks view to check what areas of my database have locks
We've been using the sys.database_files view and the FILEPROPERTY function to get the size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.