Why does second control default to Admin Skin?

Last post 12-29-2005 3:16 PM by kparker. 4 replies.

Sort Posts:

  • Why does second control default to Admin Skin?

    12-29-2005, 12:48 AM
    • Member
      550 point Member
    • kparker
    • Member since 04-04-2004, 2:18 PM
    • Gainesville, Georgia
    • Posts 115
    If two controls make up a module and one control calls the second, why does it always default to the "Admin Skin"?
     
     
    Here's the background...............
     
    I've created a new module that has two controls.  (This is similar to the core's contacts module.)
     
    List control - list out the items
    Edit control - allows the user to edit the selected item
     
    The "List" control has the following module def:
    Key: --blank--
    Type: View
     
    The "Edit" control has the following module def:
    Key: Edit
    Type: View
     
     
    The "List" control displays a datagrid for the user to select the item to edit.  It has the following:
     
    <asp:HyperLink id="editItem" NavigateUrl='<%# EditURL("ItemID",DataBinder.Eval(Container.DataItem,"ID")) %>' runat="server">
              <asp:image id="editItemImage" imageurl="~/images/edit.gif" alternatetext="Edit" runat="server" />
    </asp:HyperLink>
     
    When the user clicks on the edit.gif, it correctly goes to the "Edit" control, but the problem I have is that the "Edit" control is displayed with the Admin Skin.
     
    The page that this module is on has the permission's View checked for "All Users", so all Users are able to View.
     
    I believe that this is a bug since the module allows all users to "view" it, but for some reason, it always defaults to the "Admin Skin".
  • Re: Why does second control default to Admin Skin?

    12-29-2005, 5:34 AM
    • Contributor
      6,015 point Contributor
    • leupold
    • Member since 06-01-2004, 9:17 AM
    • Karlsruhe / Germany
    • Posts 1,197
    It is DNN standard, that all dependend controls (that are reached from the default control of the module) are displayed using the admin skin.
  • Re: Why does second control default to Admin Skin?

    12-29-2005, 9:04 AM
    • Member
      550 point Member
    • kparker
    • Member since 04-04-2004, 2:18 PM
    • Gainesville, Georgia
    • Posts 115

    But why???  I know that's the way it's always been, but why can't the second control use the same skin as the first control?

    If the module's page has the permission for "All User" to be able to view it I don't think it should be displayed with the Admin Skin.  If it has the "Edit" permission, then I can see that it should be using the Admin Skin.  Just my opinion...

    About a year ago I was looking into this subject, but dropped it..... If I remember correctly, I had determined that during the loading of the second control, it was actually an error that caused the skin to default to the admin skin.  I'll have to look back into it.

    Are there any work arounds to this?  Is there any way to "force" a skin for a module?  The only way I have been able to accomplish my goal here is to set the Admin Skin/container to the same as the Portal Skin.  Another way to accomplish this is to have two modules;  Module "A" has the "List" control.  Module "B" has the "Edit" control.

    Any other suggestions?

  • Re: Why does second control default to Admin Skin?

    12-29-2005, 10:20 AM
    • Star
      10,740 point Star
    • nokiko
    • Member since 10-22-2002, 2:36 PM
    • Utrecht, Netherlands
    • Posts 2,146

    well i never liked this either, ou can either do a core change ( i think it was commneting out or changing a few lines of code )

     

    or you can make a dispatch module, so that you have the main module as a holder for the rest of the controls. ( so in this control you either load normal view, detail view, super detail view  etc

    Armand Datema
    5 Skins, 4 SkinObject, 38 Containers, 2 Modules and more Euro 50 a year.
    SchwingNuke
    Offshore DNN and ASP.net development
    Container Creator
  • Re: Why does second control default to Admin Skin?

    12-29-2005, 3:16 PM
    • Member
      550 point Member
    • kparker
    • Member since 04-04-2004, 2:18 PM
    • Gainesville, Georgia
    • Posts 115

    Here's what I've come up with after reviewing some other posts about passing skinsrc, skinname, containersrc, and containername as querystring parameters to force a skin/container.

    What I've done is create a function that I pass in the standard EditUrl & the PortalSettings.ActiveTab.

    The from the PortalSettings.ActiveTab I can get the SkinSrc, SkinPath, ContainerSrc and ContainerPath of the current tab I'm on.


    Reusable function that builds the url string:


            Friend Function syBuildEditURL(ByVal sURL As String, ByVal objTabInfo As DotNetNuke.Entities.Tabs.TabInfo) As String
                Dim sResult As String = sURL

                Dim sSkinName As String = objTabInfo.SkinPath
                Dim sSkinSrc As String = Path.GetFileNameWithoutExtension(objTabInfo.SkinSrc)

                Dim sContainerName As String = objTabInfo.ContainerPath
                Dim sContainerSrc As String = Path.GetFileNameWithoutExtension(objTabInfo.ContainerSrc)

                sSkinName = Left(sSkinName, sSkinName.Trim.Length - 1) ' trim off last "/"
                sSkinName = sSkinName.Substring(sSkinName.LastIndexOf("/") + 1)

                If InStr(objTabInfo.SkinPath, "_default") > 0 Then
                    sSkinSrc = "[G]Skins/" & sSkinName & "/" & sSkinSrc
                Else
                    sSkinSrc = "[L]Skins/" & sSkinName & "/" & sSkinSrc
                End If

                sContainerName = Left(sContainerName, sContainerName.Trim.Length - 1) ' trim off last "/"
                sContainerName = sContainerName.Substring(sContainerName.LastIndexOf("/") + 1)

                If InStr(objTabInfo.ContainerPath, "_default") > 0 Then
                    sContainerSrc = "[G]Containers/" & sContainerName & "/" & sContainerSrc
                Else
                    sContainerSrc = "[L]Containers/" & sContainerName & "/" & sContainerSrc
                End If

                sResult = String.Format("{0}&skinname={1}&skinsrc={2}&containername={3}&containersrc={4}", _
                            sURL, System.Web.HttpUtility.UrlEncode(sSkinName), System.Web.HttpUtility.UrlEncode(sSkinSrc), System.Web.HttpUtility.UrlEncode(sContainerName), System.Web.HttpUtility.UrlEncode(sContainerSrc))

                Return sResult
            End Function


           
    When I need to call the second control, I can do something like the following:       

                    Try
                        Dim sURL As String = syBuildEditURL(EditUrl("ItemID", Null.NullInteger.ToString), Me.PortalSettings.ActiveTab)
                        Response.Redirect(sURL, True)
                    Catch exc As Exception
                        ProcessModuleLoadException(Me, exc)
                    End Try
                   

    Hope this will be useful to others.....               

Page 1 of 1 (5 items)