1
votes

I am working on a DotNetNuke module that consists of several different screens, with each having it's own set of user interface interactions. I decided to handle this by putting each screen in a different module control. The only way I can find to load that control is to give the link a URL via:

Globals.NavigateURL(Constants.LicenseDetailControl, "clientId=" + _clientId, "licenseId=" + data.Id, "mid=" + this.ModuleId);

Unfortunately, this restricts the page to ONLY render this specific module, due to the mid=xxx query parameter. However if I do not provide the module ID parameter then my control doesn't render at all and the page is blank.

Is there any way to render a specific control without forcing the page to only display one module?

2
Have you seen any other DNN modules that do what you're looking for? I haven't personally, but I'd think you might be able to do something using ajax and reloading only a portion of your module (if I understand the question correctly).M.Babcock
Not really but I"m relatively new to DNN. I might have to re-organize my module to use one control but dynamically loads ascx on the main control to mimic it but I'd like to avoid that if possible.KallDrexx
Do you want the separate parts of the module to go on different pages, or do you want all the content to be visible on the one page?Bruce Chapman

2 Answers

3
votes

Is there any way to render a specific control without forcing the page to only display one module?

No is the answer.

Rending a specific control by specifying the ctl type and the module Id is usually used for editing and admin modules, and they specifically exclude the other modules from the page.

As Mitchel has answered, you have to do the dynamic loading yourself. There are other modules that do this, you could copy the patterns. A lot of the Ventrian modules use their own Url specifications to load the different controls (which means not using the /ctl/xx and /mid/yy in the Url, but replacing it with your own definition, like 'view=x')

However, you can also look at spreading your module across different pages, so that one DNN page has a 'list' and another has the 'view'. This gives a more logical set of Urls (imagine a License list page called /licences and then a licence detail page called /licence/licenceId/xx). It also allows for more flexibility in using the module throughout the site. But it does make the install less intuitive because it just dumps all the modules on the one page.

I wrote a blog post on this topic a while back - trying to explain how it all fits together. It's older but all still relevant and might give you some more information. Designing, Structuring and Architecting DotNetNuke Modules

Or, as another commenter has already posted, just do full AJAX display of the content.

2
votes

Well, the answer to this isn't quite as easy as you might hope. The situation that you are looking at is what is known as "module isolation" and from a framework perspective there is no real way to get around it.

However you have a few options on how you can do this within your module to get the desired effect.

  1. In your main view control dynamically load the actual view into a PlaceHolder depending on a querystring value that you pass and process.
  2. In your main view control have panels for each of the views and show/hide them as needed via a parameter
  3. In your main view control add sub controls for each of the views. From here you can enable/disable items and viewstate as needed to handle the views, again by processing a parameter.

Personally I go with either 1 or 3. One works well and is the most clean, but I've found that some controls have issues with dynamic injection. Option 3 is preferred by me otherwise in that I can disable viewstate on all controls that are not being rendered to reduce page size that would otherwise be bloated by 2.