Content of webpage doesn't display in Module in DotnetNuke - c#

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.

Related

VSIX extension that creates a .cs file in the current project when a button is pressed

In short, im creating a Visual Studio extension in c# that enables non-automation testers to create automation scripts for web based solutions (using selenium).
We've created a template already for users that lays out the project file structure (test runners etc) and im using windows forms toolbox controls to create the dialogue windows where they will enter things like URls, Xpaths, page names etc etc
My question is this;
How on earth do i go about creating .CS files dynamically based on their inputs in these toolbox windows?
The simplest (he says) window i have is one that simply allows them to enter a URl and a webpage name. When they click the 'ok' button on this window, it should create a new .CS file with the webpage name as the class name, the url as a string that the webdriver can use to kick off the test and a few other bits and pieces as a template for them to start adding web elements to.
Any guidance would be greatly appreciated, there seems to be precious little around the web about creating VS extensions!
You got a few options here.
Typically, most people would do this by implementing a custom project item template, along with a custom IWizard based wizard associated with your template.
If you are displaying a modal UI from your IWizard.RunStarted, you can simply populate the ReplacementsDictionary with the text gleaned from your custom UI, which would then be swapped for the tokens in your templatized .cs file.
Or you could programmatically add code to the file after it was generated and added to the project (admittedly a much uglier and more difficult to code).
And finally, you could just generate the file in the project directory, and programmatically add it after the fact.
There's a number of old blog articles from the archived VSX Arcana blog that you might also find helpful.

How to import aspx pages across different Visual Studio solutions?

I'm very newer developing .NET web applications. Before read, I'm so sorry if I'm not able to explain correctly or if I'm confusing about something of .NET. Hope all of you can give me some light in .NET environment.
Context: We have two different solutions because the original idea was to develop two different applications with no common pages or content between them. Now, we need to have one of the aspx page that is in the solution1 inside the solution2 (and probably more in the future) because it's common between them.The idea is not to have two different maintenance of the same page. This two solutions have only one project inside them and each project has his own master page.
Solution1:
-Project1
Solution2:
-Project2
Question 1: Is it possible to import or use complete aspx page across the solutions? I mean, I know that is possible to import aspx files from the project1 into the project2, but doing this way, every change into the original aspx file of project1 means that is needed a new import into project2 (or this is what I think) to have the page up to date. What is the best way to share content between different solutions?
Thanks in advance.
You should be able to add the aspx page which exists in one solution (and version controlled hopefully!), to your other solution by adding it as a linked file.
MSDN explains how Visual Studio allows you to add an item as a link rather than directly adding the file to your project.
By linking to a file, you can capture ongoing changes to a source file without having to manually update a copy whenever changes are made. However, if the underlying file is deleted, the link will be broken.
To create a link to an existing item
In Solution Explorer, select the target project.
On the Project menu, select Add Existing Item.
In the Add Existing Item dialog box, locate and select the project
item you want to link.
From the Open button drop-down list, select Add As Link.
https://msdn.microsoft.com/en-us/library/9f4t9t92(v=vs.90).aspx#Anchor_0
Another helpful article by Grant Winney on the topic here:
https://grantwinney.com/visual-studio-add-file-as-link/

How to create ContentPart in orchard cms theme?

I am trying to design an orchard theme in which i need to attach some Content Part to MenuItem to add some extra info for that.I did the process of adding part as i do inside module ,but strangely enough my view didn't get displayed.after hour's of debugging i figured out that my part's editor shape (eg:Parts_MenuItemMetaPart_Edit) is added to ShapeTable of my frontend theme rather than admin theme(TheAdmin) and thus my attached part editor not displayed.so is there any possibility to create a content part from within theme?if yes, how ?
Just found this link : https://github.com/OrchardCMS/OrchardDoc/blob/master/Documentation/Add-Custom-Settings-to-your-Theme.markdown
from the link above :
... You may be wondering why we don’t just use a driver like we usually do for a parts editor template. This is due to the fact that to call the Editor method of your Driver and return a shape, you need to have specified in the Placement.info that you want to do that. Since this theme is not active in the admin section of Orchard, our themes Placement.info file is never run hence a Driver would never display anything...
So the solution is to add ActivatingFilter in ContentPartHandler like this :
Filters.Add(new ActivatingFilter<MyPart>("Site"));
for more info follow the link provided.

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.

Using a User Control from Another Project

I have built a user control in a project that I want to re-use in a separate project. I had seen similar attempts successfully accomplished by adding a reference to the original project and then registering the control via:
<%# Register Assembly="AssemblyName" Namespace="AssemblyName.Namespace" TagPrefix="xxx" %>
I did something similar, compiling the original project and referencing it in the subsequent one . The control has an asp:Repeater control within it. I then registered my control as above and placed the control on my page like so (the control has a string property named prop):
<xxx:ControlName ID="ControlId" runat="server" prop="21" />
However when I launch the control in the subsequent project, I get a null reference exception and the application chokes. Am I doing this the wrong way? Is it mandatory that I have an .ascx file in the subsequent project?
Any and all help is appreciated.
Thanks,
pbr
Just as a follow up to this:
I did some further research and learned that the mark-up language (materials on the .ascx page) do not get compiled into the assembly. Therefore you must have the .ascx file within the project that calls it if there is any markup associated with the control.
In the properties dialogue I set up a post-build event that copies the .ascx file over to the subsequent project Controls file. I reference it as I would any normal User Control and everything works fine.
Hope this helps someone out there with a similar issue,
pbr

Categories

Resources