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...Building ExtensionsBuilding ExtensionsModulesModulesMaster/Detail Approach?Master/Detail Approach?
Previous
 
Next
New Post
1/4/2011 2:59 PM
 
Hello,
(I realize this is a long and detailed post, but I think it is a very basic requirement in developing modules to be able to do a master/detail and I have not found any documentation on this at all. So I think it would be a worthwhile solution to document to enable other developers, so I hope those of you that are capable of answering, do so to help enable the continual proliferation of DNN :) )

I am new to module development. I am creating a classic Master/Detail module where the master contains a gridview that is filterable by the user, then the user can click on a row to go to the details view. I have created 3 controls to handle this:

1.) view.ascx which plays traffic cop and displays either the search.ascx or the details.ascx
2.) search.ascx which allows the user to search data and display summary results
3.) details.ascx which is displayed when the user clicks a link on the gridview for a particular row in the search.ascx

The hard part is done in creating the search.ascx and the details.ascx. But I am having problems with the traffic cop control, view.ascx.

I have tried the following approaches:
1.) Dynamically load the controls as such:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="TheDynoRoom.ascx.vb" Inherits=".TheDynoRoom" %>
 
<asp:PlaceHolder ID="phViewControl" runat="server" EnableViewState="False" />>
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
     Call LoadDynamicControl()
 End Sub
 
Public Sub LoadDynamicControl()
    Dim controlToLoad As Control
 
     Try
 
         Dim DynoRunID As Integer = Convert.ToInt32(Request.QueryString("ID"))
 
         controlToLoad = Me.LoadControl("Controls/DynoSearch.ascx")
 
         If DynoRunID > 0 Then
             controlToLoad = Me.LoadControl("Controls/MyGarage.ascx")
         End If
 
         Me.Controls.Add(controlToLoad)
         phViewControl.Controls.Add(controlToLoad)
 
     Catch exc As Exception        'Module failed to load
         ProcessModuleLoadException(Me, exc)
     End Try
 End Sub
 This started giving me problems. The first was with a ViewState error, so I turned the EnableViewState to False just to get past it. Next I was getting "Cannot unregister updatepanel" errors due to dynamically loading/unloading controls that have ajax modal popups. So I tried method 2:

2.) Show and Hide Panels each with its own control. So I created a Search panel and a Details panel and use logic to show/hide each. This works fine when I run it in visual studio, but has issues when I install and run within DNN. Here is the code:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="TheDynoRoom.ascx.vb" Inherits=".TheDynoRoom" %>
 
<%@ Register src="Controls/DynoSearch.ascx" tagname="DynoSearch" tagprefix="uc1" %>
<%@ Register src="Controls/MyGarage.ascx" tagname="MyGarage" tagprefix="uc2" %>
  
<asp:Panel ID="pnlSearch" runat="server">
    <uc1:DynoSearch ID="DynoSearch" runat="server" />
</asp:Panel>
<asp:Panel ID="pnlDetails" runat="server">
    <uc2:MyGarage ID="MyGarage" runat="server" />
</asp:Panel>

01.Imports DotNetNuke
02.Public Class TheDynoRoom
03.    Inherits System.Web.UI.UserControl
04. 
05.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
06. 
07.        Call ShowPanel()
08. 
09.    End Sub
10.  
11.    Public Sub ShowPanel()
12. 
13.        Try
14. 
15.            If Request.QueryString.Count > 0 Then
16.                pnlDetails.Visible = True
17.                pnlSearch.Visible = False
18.            Else
19.                pnlDetails.Visible = False
20.                pnlSearch.Visible = True
21.            End If
22. 
23.        Catch exc As Exception        'Failure
24.            ProcessModuleLoadException(Me, exc)
25.        End Try
26.    End Sub
27.End Class

This produces the following error in DNN upon trying to render the module:
ModuleId: 1139
ModuleDefId: 287
FriendlyName: The Dyno Room
ModuleControlSource: DesktopModules/Incite/TheDynoRoom.ascx
AssemblyVersion: 5.5.1
PortalID: 0
PortalName: TheDynoRoom.com
UserID: 1
UserName: host
ActiveTabID: 453
ActiveTabName: Test Module 2
RawURL: /dynodnn/TestModule2.aspx
AbsoluteURL: /DynoDNN/Default.aspx
AbsoluteURLReferrer: http://localhost/dynodnn/TestModule2.aspx
UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0C; .NET4.0E) chromeframe/8.0.552.224
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: 3b6e31f2-c1f9-4f65-aa65-109fdc585b51
InnerException: Object reference not set to an instance of an object.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl
StackTrace:
Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---
Source

In attempting to debug, the debugger (VS attach to process) doesn't stop at the page_load or page_init on the view.ascx traffic cop page. Yes, I have deployed the pdb and if I go into the module definitions and select the search.ascx page as the one to load for the view control, it does stop at break points. So it's like its erring out before it even gets to Page_Init??? I thought maybe the path to my Register statements were the issue, but I tried changing them and then DNN came back with a more specific error about not being able to find them, so it doesn't seem to be that...so I am stumped on what is causing the issue.

Questions:

1.) what is the suggested method (show/hide panels vs dynamic load of controls) out of the 2 I've tried (or is there another, (consider point 4 below))? I'd think dynamically loading controls so as to not have both in memory???
2.) Any ideas on how to correct the "Cannot unregister UpdatePanel error"? when dynamically loading controls?
3.) Any clue as to why LoadModule is bombing and why I can't even trace it in the debugger?
4.) Next I want the Details.ascx to be only visible by registered users but the search can be visible by any website visitor...given that, I think there may be a more desired approach by making the search and details to separate modules that can then have different security access settings. So how would you begin to link to the details.ascx from the search.ascx?

Thanks in advance for any help provided!

Chad
 
New Post
1/5/2011 12:55 PM
 
1. I prefer dynamically loaded controls
2. You might want to set the ModuleConfiguration property as well. For an example of all this I would encourage you to download the source version of DNNSimpleArticle http://dnnsimplearticle.codeplex.com/ install it from host/extensions then open up the solution.
3. It sounds like you might be developing outside of the DNN site and trying to deploy into it for debugging? I would recommend another approach, read my development environment wiki entry http://www.dotnetnuke.com/Resources/W...
4. There are a couple ways to restrict the details view. userinfo.isinrole("registered users") should suffice.

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
1/5/2011 5:06 PM
 
Chris, Thanks so much for your feedback. I've actually read a lot of your blogs and watched your starting module development video. They were very helpful to get things started. I did use the dnnsimplearticle as a reference when attempting the dynamically loaded controls. It seems like it would work if I wasn't utilizing AJAX. Have you run across this "Cannot unregister UpdatePanel error" when dynamically loading controls that utilize AJAX update panel? I have not been able to find away around that problem, which lead me to different options. I looked at your Dev Environment wiki...so what it doesn't cover is then WHERE to setup and how to debug your custom module. Yes, I am creating my custom module outside of DNN and then installing it to DNN to test...a real pain. Do you have any further documentation to bridge the gap from your article on creating the environment to actually where and how to set up your web application project? Thanks again in advance for any additional insight you can provide! Chad
 
New Post
1/5/2011 5:59 PM
 
Check out this blog/video for creating a project using the template, it talks about where I create things

http://www.dotnetnuke.com/Resources/B...

As for the update panel, in DNN there's actually a setting for your module called Supports Partial rendering, which will allow you to have DNN wrap everything in an UpdatePanel, you might try that as an option instead of putting the update panels into your module.

Otherwise I will have to go digging for an old project of mine where I put the update panels into the ASCX files themselves, I know I have one, just need to see how it was done.

Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
1/5/2011 7:28 PM
 
Awesome, I'll check out that link and try removing the update panel (I already set the module def to support partial rendering) and see if that works and post my results. Thanks Again!
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesMaster/Detail Approach?Master/Detail Approach?


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