We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

madhav_ghatole
on
Medium Priority
1,324 Views
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

Comment
Watch Question


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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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?
Screen.jpg
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.