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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Populating a HtmlModual ProgrammticallyPopulating a HtmlModual Programmtically
Previous
 
Next
New Post
7/29/2008 6:51 PM
 

I have created a page that Creates a Tab (Page) and Adds a new DNN_HTML (Text/HTML) module to the newly created page programmatically. The only problem I'm having is programmatically putting content into the Text/HTML module that I have created. I've looked at all the properties of the ModuleInfo instance of my newly created modual but I see nothing leading to any kind of thing that would let me modify the data.

Could someone explain to me how this works and how I can add text?

 

Thanks

 
New Post
7/31/2008 2:53 PM
 

Text/HTML module display static contents. So you don't wanna use it.

Adding a modlue to a page is using a module other have created. To add cms content you probable should look at other dnn modules.

If you want to develope your own module.

Try using the Widget  module.

I think you can download it in one of the dnn tutorials.

You can then display the content field using the page template.

have  fun

 
New Post
10/16/2008 2:52 PM
 

I don't know if you still need the answer, but I had the same question when I stumbled across this post.  In my case, I'm consulting for a company that needs to convert over 20,000 static HTML documents into DNN.  So, we decided to create new pages with HTML modules dynamically and populate the HTML modules with the existing document content.  We used a template web page with an existing HTML module which we copied for the new pages.  Here is some sample code I used for a demo.

        'Declare DNN page variables
        Dim tabInfoParent As New DotNetNuke.Entities.Tabs.TabInfo
        Dim tabInfoNew As New DotNetNuke.Entities.Tabs.TabInfo
        Dim tabInfo As New DotNetNuke.Entities.Tabs.TabInfo
        Dim tabCtrl As New DotNetNuke.Entities.Tabs.TabController

        'Get current page
        tabInfo = tabCtrl.GetTab(TabId, PortalId, True)
        'Get parent page
        tabInfoParent = tabCtrl.GetTab(tabInfo.ParentId, PortalId, True)

        'Set page information in new page
        'PORTAL ID
        tabInfoNew.PortalID = Me.PortalId
        'PAGE TITLE AND TAB NAME
        tabInfoNew.Title = "New HTML Module Test Page"
        tabInfoNew.TabName = "New HTML Module Test Page"
        'MORE PROPERTIES
        tabInfoNew.IsDeleted = False
        tabInfoNew.IsSuperTab = False
        tabInfoNew.IsVisible = True
        tabInfoNew.DisableLink = True
        tabInfoNew.IconFile = ""
        tabInfoNew.Url = ""
        'PARENT PAGE, PERMISSIONS
        tabInfoNew.ParentId = tabInfoParent.TabID
        tabInfoNew.TabPermissions = tabInfoParent.TabPermissions

        'Create the new page, grab the new TabID
        Dim intNewTabID As Integer
        intNewTabID = tabCtrl.AddTab(tabInfoNew)

        'Define module objects and controller object
        Dim modCtrl As New DotNetNuke.Entities.Modules.ModuleController
        Dim modInfoTemplate As New DotNetNuke.Entities.Modules.ModuleInfo
        Dim modInfoNew As New DotNetNuke.Entities.Modules.ModuleInfo

        'Get HTML module from template page (use your own module ID of any HTML module)
        modInfoTemplate = modCtrl.GetModule(370, Me.TabId, True)
        'Clone the module, clear the module ID, add the new page TabID
        modInfoNew = modInfoTemplate.Clone()
        modInfoNew.ModuleID = Null.NullInteger
        modInfoNew.TabID = intNewTabID
        'Add the new cloned module to the page, get the new module ID
        Dim intModID As Integer
        intModID = modCtrl.AddModule(modInfoNew)

        ' create HTMLText object
        Dim objHTML As New DotNetNuke.Modules.HTML.HtmlTextController
        Dim objText As DotNetNuke.Modules.HTML.HtmlTextInfo = New DotNetNuke.Modules.HTML.HtmlTextInfo
        ' set content values (new module ID, encoded HTML, etc.)
        objText.ModuleId = intModID
        objText.DeskTopHTML = Server.HtmlEncode("<h1>Hello World!</h1><p>Successful new module.</p>")
        'objText.DesktopSummary = txtDesktopSummary.Text
        objText.CreatedByUser = Me.UserId
        ' save the content
        objHTML.AddHtmlText(objText)

        'This is important - you need to make sure the cache is flush or the tab wont appear
        DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(intNewTabID)

        ' redirect to new page
        Dim strNewPageURL As String = Me.Request.Url.LocalPath & "?TabID=" & intNewTabID.ToString
        Response.Redirect(strNewPageURL, True)

I hope this is helpful to someone in the future.  By the way, to know what DNN does with HTML, you can always take a look at the module source code in the /DesktopModules/HTML/ folder.  In this case, the EditHTML.ascx.vb file was very helpful.

 
New Post
10/23/2008 2:21 PM
 

Hi there.

 

I am trying to do almost the same as BradG, but with version 4.8.4, and was wondering how to do this with that version?

After all I have managed to read, HTML/Text module has changed.

The only Class i found inside the DotNetNuke namespace, was DotNetNuke.Modules.HTMLEditorProvider.HtmlEditorProvider, but havent found any solution on how to use this.

So what I want to accomplish, is the same as BradG here, but with version 4.8.4

 

Cheers
Vidar


 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Populating a HtmlModual ProgrammticallyPopulating a HtmlModual Programmtically


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