Getting ModuleId from UserControl

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.
7/27/2009 9:51:27 AM
Gravatar
Total Posts 9

Getting ModuleId from UserControl

Hi,

I have a Module, e.g SponsorModule. In that module I have a GoldSponsorView UserControl. GoldSponsorView is a UserControl because it only display logos and stuff, while SponsorModule manages the data.

I can't get the ModuleId that is associated with SponsorModule.

I have SiteGuid and ModuleID field to Sponsor DB record to cater for multi site. Perhaps my understanding about ModuleId is wrong. If I have 2 SponsorModule in the same site, how would a GoldSponsorView tie back to SponsorModule 1.

7/27/2009 10:10:52 AM
Gravatar
Total Posts 18439

Re: Getting ModuleId from UserControl

Hi,

If you make your SponsorModule inherit from SiteModuleControl, then you will have an intrinsic ModuleId property available.

You would include your GoldSponsorView.ascx declaratively in the markup of the SponsorModule.ascx and you would manage any properties on the GoldSponsorView from code in SponsorModule. 

You can see examples of using UserControls inside a modulecontrol by looking at WebStore/WebStoreModule.ascx, it uses other UserControls internally by first registering like this:

<%@ Register Src="~/WebStore/Controls/ProductListControl.ascx" TagPrefix="ws" TagName="ProductList" %>

then declaring the control in markup like this:

<ws:ProductList id="productList1" runat="server" Visible="true" />

and it sets properties on it from code.

Hope it helps,

Joe

 

 

7/27/2009 9:42:12 PM
Gravatar
Total Posts 9

Re: Getting ModuleId from UserControl

Joe,

In the webstore example, ProductListControl is embeded in WebStoreModule.

However is my case, GoldSponsorView can be added to any page. Maybe to the home page, it display maximum 3 sponsors. The SponsorModule will be added to a new page where it display and manages all the sponsors.

Based on the Hello World Example, SponsorModule is Hello Mojo Site Module, while GoldSponsorView is HelloMojoUserControl. (I can add GoldSponsorView to Advanced Tools > Feature Installation/Configuration -> Add new feature)
 

In database each sponsor record has SiteGuid and ModuleId as it's fields. My query will filter based on SiteGuid and ModuleId.

I can ignore ModuleId during query, perhaps this will fix the issue.

 

 

You must sign in to post in the forums. This thread is closed to new posts.