DNN 4.x - How do I get the ModuleID in a Postback?

Last post 09-20-2006, 7:17 PM by Adam. 4 replies.
Sort Posts: Previous Next
  •  09-20-2006, 4:51 PM 22870

    DNN 4.x - How do I get the ModuleID in a Postback?

    I have added a custom button to my CE in DNN 4.x and I am successfully getting into my OnClick server-side routine, but now I need the current ModuleID (Text/HTML Module), and I can't seem to figure out how to get it.  Can anyone help me?

    Also, it seems that my OnClick is getting called twice when you click the button - any idea why that would be?

    Any help would be greatly appreciated!



  •  09-20-2006, 6:14 PM 22871 in reply to 22870

    Re: DNN 4.x - How do I get the ModuleID in a Postback?

    risedev,
     
    Try use ModuleId directly.
     
    >>Also, it seems that my OnClick is getting called twice when you click the button - any idea why that would be?
     
    Maybe you attach the event twice. Post your code please.
     

     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-20-2006, 6:31 PM 22872 in reply to 22871

    Re: DNN 4.x - How do I get the ModuleID in a Postback?

    OK - I know why the code was being called twice.  I had the "AddHandler" code and also defined the sub as the Click Handler (like below):
                    AddHandler ibOption.Click, AddressOf btnSaveToDOT_Click
    and
            Private Sub btnSaveToDOT_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibOption.Click

    ---

    Now, as far as "ModuleID"...
    In my Click Event Handler for my custom button (btnSaveToDOT_Click above), if I put the code in below:

                cntlCE.Text += "ModuleID: " & ModuleID & "<br>" & vbCrLf

    I get a squiggle line under "ModuleID" saying that it's not declared - I then get a compilation error with the same error.

    Is the ModuleID being edited stored in PortalProperties or some other object?  I can't seem to find any HTML Editor Provider documentation from DNN, otherwise I would continue looking myself. 

    Thanks for the help Adam!  I hope you can help me further with this problem...




  •  09-20-2006, 6:39 PM 22873 in reply to 22872

    Re: DNN 4.x - How do I get the ModuleID in a Postback?

    Incidentally, I am doing all of this coding in the CEHtmlEditorProvider.vb code
  •  09-20-2006, 7:17 PM 22874 in reply to 22872

    Re: DNN 4.x - How do I get the ModuleID in a Postback?

    Protected _parentModule As DotNetNuke.Entities.Modules.PortalModuleBase
     
    _parentModule = CType(FindModuleInstance(Me), DotNetNuke.Entities.Modules.PortalModuleBase)
     
     Public Shared Function FindModuleInstance(ByVal fCtl As System.Web.UI.Control) As System.Web.UI.Control
                Dim ctl As System.Web.UI.Control = fCtl.Parent
                Dim selectedCtl As System.Web.UI.Control = Nothing
                While Not ctl Is Nothing
                    If TypeOf ctl Is DotNetNuke.Entities.Modules.PortalModuleBase Then
                        If CType(ctl, DotNetNuke.Entities.Modules.PortalModuleBase).TabModuleId = DotNetNuke.Common.Utilities.Null.NullInteger Then
                            If selectedCtl Is Nothing Then
                                selectedCtl = ctl
                            End If
                        Else
                            selectedCtl = ctl
                            Exit While
                        End If
                        Exit While
                    End If
                    ctl = ctl.Parent
                End While
                Return selectedCtl
            End Function
     
    After you get the parent module you can get the ID by _parentModule.ModuleId

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML