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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Changing a modules controlTitle at runtime based on a certain conditionChanging a modules controlTitle at runtime based on a certain condition
Previous
 
Next
New Post
7/17/2009 8:38 PM
 

I have the following code in my EditHeadlines.ascx.vb control code behind file:

 

if DotNetNuke.Common.Utilities.IsNull(ItemID) Then'We are in update mode, so retreive the item from the database.

...

 

'Change the control title to match the mode

ModuleConfiguration.ModuleControl.ControlTitle="Edit headline"

else

'Add a new headline

...

 

'Change the control title to match the add headline mode

ModuleConfiguration.ModuleControl.ControlTitle="Add new headline"

End if

 

 

The problem is that the changes in the controlTitle doesn't take affect. I can't seem to be able to change it. How would I be able to do this?

 
New Post
7/18/2009 12:20 AM
Accepted Answer 

If you can determine what the value for the module's title should be during the module control's Page_Init event the following will work:

ModuleConfiguration.ModuleTitle = "My Module's New Title"

Note that the property to be changed is ModuleTitle, not ModuleConfiguration.ModuleControl.ControlTitle as you indicated in your code.

However, if you have to change the module's title at any point in the page life cycle later than Page_Init, for example in Page_Load, you can try the following:

Dim ctl As Control = DotNetNuke.Common.FindControlRecursiveDown(Me.ContainerControl, "lblTitle")
If ctl IsNot Nothing Then
    CType(ctl, Label).Text = "My Module's New Title"
End If

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
7/18/2009 2:46 AM
 

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

          Me.ModuleConfiguration.ModuleTitle = Localization.GetString("Edit headline")

End Sub


Leo TechnoSoft Pvt.Ltd - The Biggest DotNetNuke Development Team
 
New Post
7/18/2009 3:36 AM
 

I need to change the title of the currently displayed control, not the modules current title. When I click the "add headline" action in the actions menu for the module, the default module template that Visual Studio gives you has a default "edit content" control. Since I changed the control to handle both edit existing content as well as adding new content, it makes no sense to have "edit content" when you are really adding it. I need to have the controls title reflect what is going on with the content. I.e. it should say "add" when adding new content and "edit" when changing existing content. The problem is that:

 

1. Me.ModuleConfiguration doesn't exist in the current code. All it does is give me a list of the controls I put on the page.

2. ModuleConfiguration.ModuleControl.ControlTitle looks like it would work, but the changed title isn't being displayed for some reason.

3. I got ModuleConfiguration.ControlTitle to work at some point in time ago, but Visual Studio threw a huge fit and told me that as of DNN 5.1, ModuleConfiguration.ControlTitle was no longer used and I should use the seemingly broken ModuleConfiguration.ModuleControl.ControlTitle property.

 

Any other ideas on how to fix the problem? The code to change the controls title needs to be in the Page_Load event.

 
New Post
7/18/2009 10:48 PM
 

1. Assuming that your module control inherits from DotNetNuke.Entities.Modules.PortalModuleBase (which is must/should), there is indeed the public property ModuleConfiguration which returns the module's ModuleInfo object. I'm not following you when you say that ModuleConfiguration gives you a list of the controls I put on the page.

2. If it works at all, setting ModuleConfiguration.ModuleControl.ControlTitle would only have an effect on the displayed title if that property was set during the control's Page_Init not Page_Load event. Likewise with setting ModuleConfiguration.ModuleTitle.

3. ModuleConfiguration.ControlTitle was deprecated (made obsolete) in DNN 5.00.00 and was replaced by ModuleConfiguration.ModuleControl.ControlTitle.

Since by default the ControlTitle is what gets displayed as the module title for any control other than the default view control, it is actually the ModuleTitle property which you need to change dynamically. Since you indicated that you cannot do that until the Page_Load event handler, it will be necessary to use my second suggestion. Did you try that approach?


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Changing a modules controlTitle at runtime based on a certain conditionChanging a modules controlTitle at runtime based on a certain condition


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