• Login
  • Register

DNN Forums

A community discussion page. We're starting from scratch, so...let's get the party started!

DeleteTab Stored Procedure

You are not authorized to post a reply.

New Member

New Member


    I am hoping you can help or point me into the right direction.  We recently upgraded out DNN framework from v5.5.1 to V7.3.4.  After the upgrade was complete, we noticed our Tab menu reordering was rearranged.  We traced it down to the stored procedure of "DeleteTab".


    In V5.5.1 we have the following code in proc "DeleteTab"






    ALTER procedure [dbo].[DeleteTab]

    @TabId int


    delete from dbo.Tabs

    where  TabId = @TabId

    In V7.3.4, we have the following code in proc "DeleteTab".  We have traced it down to the update statement causing the reordering of our menu incorrectly. 

    My question is can you please help me understand why this code was introduced and/or if there is a fix for this? 

    If there is a fix, how do I update this stored procedure?  Any information you can point me to or provide would be greatly appreciated.


    /****** Object:  StoredProcedure [dbo].[DeleteTab]    Script Date: 05/15/2020 15:00:37 ******/





    ALTER PROCEDURE [dbo].[DeleteTab]

        @TabId Int  -- ID of tab to delete; Not Null and > 0



        DECLARE @TabOrder Int

        DECLARE @ParentId Int

        DECLARE @ContentItemId Int

        SELECT @TabOrder = TabOrder, @ParentId = ParentID, @ContentItemID = ContentItemID FROM dbo.[Tabs] WHERE TabID = @TabId


        -- Delete Tab --

        DELETE FROM dbo.[Tabs] WHERE  TabID = @TabId


        -- Update TabOrder of remaining Tabs --

        UPDATE dbo.[Tabs]

            SET TabOrder = TabOrder - 2

            WHERE IsNull(ParentID, -1) = IsNull(@ParentId , -1) AND TabOrder > @TabOrder


        -- Delete Content Item --

        DELETE FROM dbo.[ContentItems] WHERE ContentItemID = @ContentItemId




    New Member

    New Member


      Please note that I haven't tried or tested this, but the SP from 9.6.1 looks better indeed:
      ALTER PROCEDURE [dbo].[DeleteTab]
        @TabId INT  -- ID of tab to delete; Not Null and > 0
          DECLARE @TabOrder INT
          DECLARE @ParentId INT
          DECLARE @ContentItemId INT
      	DECLARE @PortalId INT
          SELECT @TabOrder = TabOrder, @ParentId = ParentID, @ContentItemID = ContentItemID, @PortalId = PortalID FROM dbo.[Tabs] WHERE TabID = @TabId
          -- Delete Tab --
          DELETE FROM dbo.[Tabs] WHERE TabID = @TabId
          -- Update TabOrder of remaining Tabs --
          UPDATE dbo.[Tabs]
              SET TabOrder = TabOrder - 2
              WHERE ISNULL(ParentID, -1) = ISNULL(@ParentId , -1) AND TabOrder > @TabOrder 
      		AND (PortalID = @PortalId OR (PortalID IS NULL AND @PortalId IS NULL))
          -- Delete Content Item --
          DELETE FROM dbo.[ContentItems] WHERE ContentItemID = @ContentItemId

      You could try this one on your installation and see if that helps. (But do it on a test system first, create backups etc.)
      Obviously it would be better to upgrade to a newer version of DNN, but I'm assuming you took 7.3.4 for a reason...

      Hope this helps
      You are not authorized to post a reply.

      These Forums are dedicated to discussion of DNN Platform.

      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.

      Would you like to help us?

      Awesome! Simply post in the forums using the link below and we'll get you started.

      Get Involved