how to navigate from one control to another in a dotnetnuke module

Posted on 2009-02-11
Last Modified: 2012-05-06
I am developing a module HK in dotnetnuke.
It has controls as EditModulename.ascx,ViewModulename.ascx and New1.ascx.
This module is on home page, when i run this it shows the ViewModulename.ascx control on home page.
Now i have one link button cmdL1, I want to display a New1.ascx control after clicking on cmdL1 button. How can i do this?

I tried as follows but it didn't work. it gives error
as below

Error: New is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to cast object of type 'ASP.desktopmodules_hk_new1_ascx' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. ---> System.InvalidCastException: Unable to cast object of type 'ASP.desktopmodules_hk_new1_ascx' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---
Thank You.
Protected Sub cmdL1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdL1.Click

            Dim objModules As ModuleController = New ModuleController

            Response.Redirect(NavigateURL(PortalSettings.ActiveTab.TabID, "New1", "mid=" & CStr(ModuleId)))

        End Sub

Open in new window

Question by:madhav_ghatole
    LVL 12

    Accepted Solution


    To navigate to a different user control from bunch of controls in your dotnetnuke module, you need to know the key for that user control that you gave while installing the module

    For navigating to specific control in your module (you must have given it some key), you must need a key. To see what key you have given, go to module definitions page, click the edit button beside your module and look at the key it has for example it has key "abcd" without the quotes, then to go to that user control from any other control in that module, you have to do

    Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "abcd", "mid=" + ModuleId.ToString()));

    where abcd is the module key, ad moduleid you can get it as its a global variable in your control.

    Let me know if it is confusing, I'll explain in detail.

    Author Comment

    I have already given key "New1" to the control New1.ascx
    and tried

                Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "New1", "mid=" & CStr(ModuleId)))

    But it gives error as below, how can I solve this?
    LVL 12

    Expert Comment

    aww I was expecting an 'A'  however, note that you have a error on the page, which says one or more module did not load. Get rid of that error and you should be fine.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now