How to make new page programmatically in DNN - c#

How can I make new page at the same time as the plugin is installed? Later that plugin should be at newly created page. Is it possible to do this in DNN?
Thanks.

When the module is installed you can add a new page in the UpdateModule process, using something like
TabController.Instance.AddTab(...)
But I am not sure if you can also add the module itself on that page, as the install progress is propably not fully done yet. You have to try, you need a new Module instance for that and a record in TabModules with the TabID and the ModuleID.
Have a look at the IUpgradeable interface.
Happy DNNing!
Michael

Related

Content of webpage doesn't display in Module in DotnetNuke

I am new in DotnetNuke. So, first of all I don't know all terminology. My problem is content of Webform.aspx doesn't display in Module.
Let me describe the steps so it can be easy to track the missing steps if any.
1- Created a project of DotnetNuke 7 C# Compiled Module. Path:
F:\website\dnndev.me\desktopmodules\DNNModule2
2- Added a WebForm1.aspx and add a line "Hello World"
3- Build project, DNNModule2_00.00.01_Install.zip is generated in
F:\websites\dnndev.me\DesktopModules\DNNModule2\DNNModule2\install
4- Added extension in http://www.dnndev.me/Admin/Extensions. It added
successfully in Modules.
5- Created New Page and added DNNModule2 by drag and drop. But it
doesn't display content "Hello World" of WebForm1.aspx.
Do I need to set any property while I am adding Module in New WebPage?
Also suggest if my flow is wrong. I will be happy to improve.
Thanks
For a DNN module to work properly you need to work with an .ascx user control. Typically these will inherit from the PortalModuleBase class. There are a few options, but that is the most common.
.aspx pages themselves can exist in DNN, however, they are ONLY available if you access them directly, and not through the module process.
Your user control, when setup should be part of the .dnn manifest and referenced with a <controlkey/> value. (As in no control key defined, to be the default view of your module.)
If you are not using a template, this one is a great example.

DNN module development with Razor and C#

I want to add a Razor module to my CMS which was created by DNN. In that razor module I need to show data from database. What would be the best way to do it.
Need a help
Thank you,
Nayanajith
Add an instance of the Razor Host module to a page, and start from there. If you look at the Wiki on dnnsoftware.com, you'll find some more stuff.
For more than complicated uses, that a look at the 2sxc module free at sexycontent.codeplex.com.
If you are planning to get data from the DNN database, you'll want to learn about the DNN api.
I found a simple solution to my problem.
I created a Empty ASP.NET project in visual studio.
Then added Razor page in to that particular project (remember to
delete configuration file).
Then I use connection string and created normal database access class
and added functions which I needed.
Then published the ASP.net Web application and put it in to the DNN
DesktopModule/RazorModule folder and created the module from the DNN
admin.
Now it works fine :)

How to set custom module as default in orchard cms

I made a custom module in orchard CMS.I want this custom module as startup module when i run my site but orchard always makes home page as start up.how can i make my custom module as Startup in orchard.My module is simple Mvc application using Entity frame work as db .I am pretty new to Orchard i am learning it.Any Help would be appriciated Thanks Advance
In order to steal the home route, you will have to write your own route, and give it high priority. Removing the alias for the current home page will also help.
If your module contains a content type and that content type has an autoroute part then there will be a checkbox in the edit content admin page that says 'Set to homepage'.
You can create lots of different types of modules in Orchard and not all of them contain content types. You can add an autoroute part to a content type that doesn't have one.
It is not true to say "set a module as start up".a module is not an stand alone mvc application, but it is a way of extending existing functionalities.
you can create a ContentType inside your module and orchard will provide the dashboard user with creating of new instance of your type.then user can set this instance as home page content.
to write your own ContentType check here.

Custom URL to a user control within my custom module

I am building a module for dot net nuke.
It is similar to a HTML module but with some customizations. The user would add it multiple times on a page. I would like to create a hyperlink that the user can use to view the each one of the modules individually.
I want to add functionality so that a particular module can be displayed with its contents as if it were added to a page.
e.g I add the module 3 times on /News.aspx:
Article1
Article2
Article3
I would like these urls to work (without actually creating those pages(:
/News/Article1UniqueKey
/News/Article2UniqueKey
/News/Article3UniqueKey
The Unique key would be the module ID by default or a string that the user would enter in the edit page for a module.
How do I achieve this.
This could be achieved in a few ways. The most common way is using FriendlyURL provider, such as one for Ifinity's URLMaster. You can find a number of providers available, with source, at http://www.ifinity.com.au though things will change a little bit with DNN 7.1 as URLMaster is being integrated into the product, I believe the providers will just need to be recompiled against DNN 7.1 instead of older versions.

Create a dynamic project template in VS 2010?

This might sound a bit of an odd question but I know what I want to achieve, just don't know if it's possible.
Firstly, I'd like to be able to create a visual studio project that the 2 developers that work with me can use as a basis for all new websites. I want to drop all the common files that we use in there, like jQuery, CMS files etc. so that every time they start a new project they don't have to worry about all of that stuff. I guess to do this I just set up a project and "File > Export Template" ?
Now, here's the tricky bit...
When you open up one of the default templates in VS it asks you a few questions, such as if you want to use a master page or if you want to use code behind etc.
What I would like to do is set up something similar so that when you use the project template it asks you what version of jQuery you want to use so that it can import the right file, or for example it might ask you if you want to include certain user controls that the CMS contains. If you tick the box then the folder with the necessary user controls would be put in your new project for you.
I know MS can do this but can a user like me include functionality like that in my own project template?
Hope that makes sense.
Some more digging turned up the iWizard interface and this tutorial...
http://msdn.microsoft.com/en-us/library/ms185301

Categories

Resources