I'm trying to incorporate this non-DNN dev page (http://hstoneart.com/Port...stoneArtGallery.aspx ) into a new page template file. The new file is based on the Xcillion Inner.ascx; the problem is that I can't get the code-behind to work. When I load a page using the new template, I get the error "Could Not Load Theme: /Portals/_default/skins/hstoneartskin/hsa_inr_modal.ascx, Error: E:\web\drawingwork\htdocs\Portals\_default\skins\hstoneartskin\HSA_inr_modal.ascx.vb(11): error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)".
The pages appear in Visual Studio Solution Explorer as parent and child. I've Googled and tried different combinations of "Class Name" and "Inherits" values, I've added a Namespace, and I've cleared the VWDWebCache folder and rebuilt the web. I know I must be missing something basic. Can anyone help? Thanks.
Control declaration: <%@ Control Language="vb" AutoEventWireup="false" Explicit="True" CodeFile="HSA_inr_modal.ascx.vb" Inherits="hstoneArtGallery" %>
Beginning of code behind:
Imports System Imports System.IO Imports System.IO.Directory Imports System.Web Imports System.Data
Partial Class hstoneArtGallery Inherits System.Web.UI.Page
I think the editor deleted some of the code you posted?
Actually, I left it out. I figured that the code inside the Class tags would be of little interest. Here's the code:
Partial Class HstoneArtGallery Inherits System.Web.UI.Page
Function ImportTextFile(ByVal strTextFileName As String) As String Dim strTextFilePath As String = Path.GetDirectoryName(Server.MapPath(Me.ToString)) & "\notes\" Dim strReturnedText As String Using sr As New StreamReader(strTextFilePath & strTextFileName)
strReturnedText = sr.ReadToEnd() End Using
Return strReturnedText
End Function
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strPathToImagesFolder As String = Path.GetDirectoryName(Server.MapPath(Me.ToString)) & "\images\" 'declares path to images folder Dim strFileSystemEntryImage As String Dim arrGetFiles() As String = Directory.GetFiles(strPathToImagesFolder) 'sets up array of files in image folder Dim arrFileNames() As String Dim strFileName As String Dim strCleanedFilename As String Dim arrAltTitleTag As Array Dim strAltTitleTag As String Dim intNameCounter As Integer Dim imgAltTag As String intNameCounter = 0
Dim imgID As String
Dim strThumbnailsMaker As New StringBuilder strThumbnailsMaker.Append("
arrFileNames = Split(strFileSystemEntryImage, "\") 'splits strFileSystemEntryImage on backslash strFileName = arrFileNames(arrFileNames.Length - 1) strCleanedFilename = WriteFileInfo(strFileName) imgAltTag = strCleanedFilename.Replace("", "") imgAltTag = imgAltTag.Replace("", "") imgAltTag = imgAltTag.Replace("""", "")
arrAltTitleTag = Split(strFileName, "!")
imgID = "ID_" & intNameCounter.ToString
strAltTitleTag = arrAltTitleTag(1) & " by " & arrAltTitleTag(2) strAltTitleTag = strAltTitleTag.Replace("_", " ")
strThumbnailsMaker.Append("
strThumbnailsMaker.Append("") strThumbnailsMaker.Append(" " & strCleanedFilename & "") strThumbnailsMaker.Append("" & ImportTextFile(intNameCounter & ".txt") & "") strThumbnailsMaker.Append("
" & strCleanedFilename & "
" & ImportTextFile(intNameCounter & ".txt") & "
End Sub
Private Function WriteFileInfo(ByVal strFilenameInfo As String) As String Dim arrSplitOnExclamation() As String Dim strToReturn As New StringBuilder If InStr(strFilenameInfo, "!") > 0 Then strFilenameInfo = strFilenameInfo.Replace("_", " ") arrSplitOnExclamation = Split(strFilenameInfo, "!") Dim arrLastValue() As String arrLastValue = Split(arrSplitOnExclamation(5), ".") strToReturn.Append("") strToReturn.Append(arrSplitOnExclamation(1)) strToReturn.Append(", ") strToReturn.Append(arrSplitOnExclamation(2)) strToReturn.Append(", ") strToReturn.Append(arrSplitOnExclamation(3)) strToReturn.Append(", ") arrSplitOnExclamation(4) = Replace(arrSplitOnExclamation(4), "in", """") strToReturn.Append(arrSplitOnExclamation(4)) strToReturn.Append(", ") strToReturn.Append(arrLastValue(0)) Else strToReturn.Append(" ") End If Return strToReturn.ToString End Function
End Class
-------------------------------
Here's the Control statement at the top of the ascx file:
<%@ Control Language="vb" AutoEventWireup="false" Explicit="True" CodeFile="HSA_inr_modal.ascx.vb" Inherits="HstoneArtGallery" %>
I changed:
to
Partial Class HstoneArtGallery Inherits PortalModuleBase
and the error remained. I probably didn't do that exactly right.
I'm not trying to write a module, just a page template.
Posted By Britomart on 10 Aug 2022 05:37 PM I changed: [...] I'm not trying to write a module, just a page template.
[...]
In that case I would recommend to have a look at one of the multi-purpose modules like OpenContent or 2sxc. It should be easy to achieve your goal with one of these if you're familiar with HTML and JavaScript.
Happy DNNing! Michael
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.