Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Working With MVPWorking With MVP
Previous
 
Next
New Post
5/15/2010 2:29 PM
 
I've been working on a new module template[which I use the AWESOME Codesmith Tools for] to create the base of my modules and after some research and methods I was working on myself, I re-found this blog post http://www.dotnetnuke.com/Community/B... about using the MVP method. Looking over the MVP for a few hours, I decided to try and mod my template to use it.
I stumbled across a change that I'm not sure how to do, or how I should adjust my style to accommodate for.

How do I access ModuleId/UserId/PortalId/ect in the ascx.cs file?

I'm sure I'll have many more questions as I progress in modifying my template. :)
Thanks
 
New Post
5/15/2010 5:32 PM
 
I found an answer, I don't think it's optimum, but it might be.
Using
ModuleContext.ModuleId/PortalId/TabId
and
ModuleContext.PortalSettings.UserId/UserInfo

These look like they will work, but it seems a lot of typing to get the UserId, which I accessed by 'UserId' before.
 
New Post
5/15/2010 7:33 PM
 
Surely your template can generate a simple forwarding property.  Somthing like

Public Property Tabid as Integer
    Get Return ModuleContext.TablId
End Property

(not compiled - just typed)

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
5/15/2010 11:30 PM
 
...
Why yes, yes it can.

Though, I'd have to do that for each control [View, edit, settings, ect] and I hate to have duplicated code like that. So I was hoping for an alternative way to 'wrap' it for simpler code.

I've worked on it a little more, and I got a solution I can accept. I think there is a slicker way, just not sure what it is yet. :)

I have a common code file, which I created a Module class, where I pass in the ModuleContext to the constructor and assign the values. I then declare it as a variable in my control class, and initialize it in page load. That way I should have it initialized and available 'everywhere'. I just access them by
module.UserId
which is about as best as I'm expecting, unless it's exposed in the (I)ModuleView class.

It'll work, but feels a little hackish, but reduces the duplicated code.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Working With MVPWorking With MVP


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out