How to add new an .ascx module to mojoportal

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
8/24/2006 9:37:46 AM
Gravatar
Total Posts 9

Re: How to add new an .ascx module to mojoportal

Hi,

Now I need help with understanding some logic of creating new page and user controls.

I'm working with mojoPortal a couple of days. I have following problem.

I want to add my own page to mojoPortal.
I uploaded it on server and now I need to add some existing (my own or from mojoPortal) modules  to this page. I want to do it using admistrator features - is it possible?

 

When I add new page by using administrator features then page is not created phisical, but I need realy aspx file in order to link to this page from my sample module. Howerver, in this way I can add any module to created page in that way. I know that I can get link form newly added page (the link is with attribute pageIndex and pageID) but when somebody delete and create one more time this page then I have to change link in my sample module (I have to correct pageID).

8/24/2006 10:00:57 AM
Gravatar
Total Posts 18439

Re: How to add new an .ascx module to mojoportal

I think it would be clearer to you if you were working with the mojoportal source code instead of just against the compiled version. Then you could look at how other modules are implemented.

Pages that are in the menu can contain any modules but modules should never link to these pages for the reason you have found, they have no knowledge of the menu or page ids.

But modules can have related .aspx pages that they link to. These pages should inherit from mojoBasePage to support skinning but these pages do not appear in the menu and are only available by links from within the module because the module does know about these pages.

For example Blog Module, the module is BlogModule.ascx but it links also to BlogEdit.aspx and BlogView.aspx but neither of these pages are available in the menu they can only be accessed by links from the BlogModule.ascx. BlogModule passes in parameters to these pages and knows about these pages but it does not know about pages in the menu. In fact the blog module can exist in more than one menu page because you can have as many blogs in a site as you want but each has a different module id and item ids for the posts.

Why not just work with the mojoPortal source code where you can see the examples. There are even examples of external module in the source code which shows how you can have a post build action in the external project to copy the output (dll, .ascx, .aspx) from your external module to the correct locations in mojoportal web


Hope it helps,

Joe
8/26/2006 1:38:03 AM
Gravatar
Total Posts 9

Re: How to add new an .ascx module to mojoportal

Hi,

I downloaded the latest version of mojoPortal. I see there is base class named mojoBasePage so any own page can inherited from it.

However I must develop extra features for mojoPortal which use framework 1.1 so there is no mojoBasePage class.

What I need to do?
I created page e.g. MyPage.aspx with following code:

<%@ Page language="c#" Codebehind="MyPage.aspx.cs" AutoEventWireup="false" Inherits="Test.MyPage" %>
<%@ Register TagPrefix="portal" Namespace="mojoPortal.Web" Assembly="mojoPortal.Web" %>
<portal:MasterPage id="MPContainer" runat="server">
<portal:ContentRegion id="MPTitle" runat="server"></portal:ContentRegion>
<portal:ContentRegion id="MPLeftPane" runat="server"></portal:ContentRegion>
<portal:ContentRegion id="MPContent" runat="server"></portal:ContentRegion>
<portal:ContentRegion id="MPRightPane" runat="server"></portal:ContentRegion>
<portal:ContentRegion id="MPPageEdit" runat="server"></portal:ContentRegion>
</portal:MasterPage>
Then I added this page using administrator features Add/Edit page and I checked "Use url" with http://myserver/MyPage.aspx

Now I want to add same existing or my own modules (content) to this page by administrator features. I don't see any solution to do this with no mojoPasePage parent class. Yes I know that it can be done by inserting code to MyPage.aspx.cs to load extra modules (the same as in default.aspx.cs code file) but it is not good way.

Thank you.
Best regards
wtct
8/26/2006 5:38:40 AM
Gravatar
Total Posts 18439

Re: How to add new an .ascx module to mojoportal

Hi,

You would use the 1-0-4-src download not the latest version for 1.1 framework development

Yes there is no mojoBasePage in that version and it uses Paul Wilson's MasterPages implementation
Content modules can only be added using the web interface to virtual pages which are served from Default.aspx?pageid=somenumber (though friendly urls can be mapped over these)
New physical Pages that you add cannot be used this way though you can make them appear in the menu as you have found

If you want to add modules using the web interface you should just use virtual pages
I usually only add physical pages for edit pages or module specific pages and I link to those from inside the module not from the menu

Hope it helps,

Joe
8/28/2006 2:44:50 AM
Gravatar
Total Posts 9

Re: How to add new an .ascx module to mojoportal

Hi,

Your last post was ok but I have two new problems.

Problem 1.

When I use map url then query parameters in url do not work. What I mean? I created two pages (using admin panel) named PageOne.aspx and PageTwo.aspx. Then I added user control as a content (new module) to these pages: one named ModuleOne.ascx and ModuleTwo.ascx. 
I maped one adress http://server/PageTwo.aspx (firiendly url) to http://server/default.aspx?pageindex=...&pageid=..
Inside ModuleOne.ascx I have a link with http://server/PageTwo.aspx?myParam=... 
In page_load event ModuleTwo.ascx (content of PageTwo.aspx) I want to recive myParam value.
How can I do it?

Problem 2.

I have button on Default.aspx. Code of this Button is:
Response.Redirect("SomeExistingPage.aspx").
When open the browser with http://server/ and click on button I get error message that page could not be displayed. But when I open browser and go to http://server/default.aspx (it is the same page as http://server/) and next click on button then correct page is displayed (SomeExistingPage.aspx)

Thank you.

wtct

8/28/2006 3:02:43 AM
Gravatar
Total Posts 18439

Re: How to add new an .ascx module to mojoportal

I'm afraid I don't have solution to problem 1 at the moment. The idea of the friendly urls was that you wouldn't see the query string params. If you need additional query string params you may not be able to use friendly urls on that page.
I will look into this and see if I can figure out a solution for a future release.

Problem 2 you could try using more fully qulified urls or something like

Response.Redirect(Page.ResolveUrl("~/SomeExistingPage.aspx"));

Keep in mind that if you deploy on mono it will be case sensitive
You must sign in to post in the forums. This thread is closed to new posts.