Create Module Control during installation of module in DNN - dotnetnuke

I have finished developing my module for dotnetnuke, but I need to have my controls pages already added after the module is installed instead of adding all the control pages myself

Found my answer:
In the solution explorer, there is a file that is called the name of your module with the file extension of dnn. Ex: MyModule.dnn
Open that and look for the tag <moduleControl>. From there you can create your own control that will be added during the installation process.
Here is my example:
<moduleControl>
<controlKey>GestionCategories</controlKey>
<controlSrc>DesktopModules/DemandePosteEnLigne/GestionCategories.ascx</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>Gestion des Categories</controlTitle>
<controlType>Edit</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
<supportsPopUps>True</supportsPopUps>
</moduleControl>

There is no event in dnn like OnModuleInstalled or something. But you can achieve what you want to do by creating page template/ portal template based on your requirements.
If you are willing to create 2-3 new pages, you can simply export those pages as template and then you can use dnn file manager to upload the page templates and then use those page templates to create pages. Good thing about this is, in future also, if you want to create similar pages, you can re-use those templates.
If you are willing to create entire portal's page hierarchy which includes more than 5 pages, you need to go for portal template. You can export portal as template by login to host account and go to Host > Portals (Site Management). You have to upload your portal template through FTP and then you have to create your new template by using that template.
Let me know if you need any other help.
Thanks

Related

How to edit Default.Page.Template Content in DotNetNuke?

How to change home page content in DNN while creating a site itself.
I need to change different page. I created a new page and created Template. And I replaced inside Templates folder named (Default. page. template). But it is not working out. Provide me a better solution.
Probably the easiest way to do this is to create a site using the default template, edit that site to create your own site, and then save that as a site template (suitable named). You can then use that site template to create sites with the page structure that you want.
The default page template (I believe) is used when you create new pages using the the Pages UI. I don't believe that the default page template is used by the default site template.
If you have created a page and would like to apply a specific page template to the new page retroactively. To do this, go to the page that you want to change and append ?ctl=ImportTab to the url. That will bring up a dialog that allows you to change the emplate for a page with lots of options. It

get 2sxc app data from different portal DNN

We are setting up different sites as portals in DNN. Some content will be shared across the different portals.
I'm using the following method to render 2sxc data in a page
http://2sxc.org/en/blog/post/using-2sxc-in-webforms-custom-webapi-or-other-razor-hosts-300
However, now i want get the same data in another page of a different portal.
Can any one help with the code so i just put in the source portal id and it can be rendered in a different portal?
Yes, this can be done :)
There's an App Data DataSource, where you can specifiy the portal and app-id (in 2sxc 8.5+). Use this in a visual query or in your code.
http://2sxc.org/en/Docs-Manuals/Feature/feature/9266

Dotnetnuke Skin Issue

Hi Chris We using DotNetNuke 6.2.3 enterprise edition. In localhost all images i referred in skin file was came both login and Logout Period.I followed the following steps.1st I need to create one child portal. so i went Host-->SiteManagement-->Add New Site--> i choosed the child portal and also site title,description,keywords.I can able to create child site. After that i went Admin-->SiteWizard-->Blank Template-->Replace Content-->I choosed my installed skin and container in portal.And also I added HTML Modules. Both Skin and HTML Contains image tag.
Now I login as a superuser -->My content, Images ,Style properties everything came fine.
Once i logout skin file not loaded due to that page alignment collapsed. Next in chrome i went inspect element i am not able to open those images.If i login as a host i am able to see those files.
Can you please share one of the URLs to the images that aren't working?
Perhaps you have the permissions in your DNN file manager setup so that you have to be logged in to view all of the files in the folder. You can go to the file manager, click on a folder, and manager permissions from there.

DNN Module - Create Page for View.ascx

I have create a DNN Module using the Visual Studio DotNetNuke 7 C# Compiled Module template. When my module is installed, I would like to create a page for View.ascx. How can I do this? Can this be done when I upload the module in Host > Extensions?
From the Control Panel you should use the Add new page functionality, then place your Module on that newly created page.
Check out this video for how to Add a page in DNN7.
http://www.dotnetnuke.com/Resources/Video-Library/Viewer/Video/549/View/Details/How-to-add-a-page-in-DotNetNuke-7.aspx
And this one for how to adda module to a page
http://www.dotnetnuke.com/Resources/Video-Library/Viewer/Video/537/View/Details/How-to-add-a-module-to-a-page-in-DotNetNuke-7.aspx
To answer the question specifically about having this done automatically with the module, yes, you can, BUT you have to write code to do this and I only recommend it for special circumstances.
I've seen this done using an implementation of the IUpgradable interface in DNN to detect an initial installation and create the page using DNN API calls.
There is some detail in the Wiki about how IUpgradable works

Get session of DNN in aspx file

I write a standalone aspx file and upload it to DNN website. I add a html module and make an iframe to that aspx file. How I should check DNN user login or not in aspx file? I think there are something in Session but it is empty when I print it out on aspx page.
The aspx file executes outside of DNN. There is no context for you to work with. A much better approach is to turn your .aspx into a .ascx and derive from PortalModuleBase as the start of a DNN module. You can add a proper module to the page and permission the module as you see fit and DNN will take care of all the authentication and authorization details for you.
A starting point for module development
I don't recommend it in this situation, but you can also emulate the approach I described for getting context in a web service.
https://stackoverflow.com/a/9164573/51851
If your aspx is within DNN's website you can simply use Request.IsAuthenticated to check if user is logged in or not.
But be warned, if you have friendly URL turned on - DNN 5x and above will hijack you aspx request.

Resources