It is easy to change the title of a module programmatically, something like
private void Page_Init(object sender, System.EventArgs e){ ModuleConfiguration.ModuleTitle = "Whatever"; }
But how can I do this for a control (eg. "Edit"). I know it is possible in the resource file by adding a key "ControlTitle_edit", but is this possible from the code behind somehow?
Happy DNNing! Michael
Michael TobischDNN★MVP
I found somethng in an old code I wrote some years ago:
protected override void OnPreRender(EventArgs e) { ModuleContext.Configuration.ModuleTitle = Localization.GetString("Whatever", LocalResourceFile); base.OnPreRender(e); }
I am sure that worked at the time I wrote it, but it does not anymore. I tried to use this instead of the code above:
protected override void OnPreRender(EventArgs e) { ModuleContext.Configuration.ModuleControl.ControlTitle = Localization.GetString("Whatever", LocalResourceFile); base.OnPreRender(e); }
No luck. Anyone who can bring light into the darkness? Is it a bug?
protected override void OnInit(EventArgs e) { ModuleConfiguration.ModuleControl.ControlTitle = Localization.GetString("Whatever", LocalResourceFile); base.OnInit(e); }
Posted By Ryan Jagdfeld on 9/5/2023 1:14 PM I recently had this exact same need and found what you have works in the OnInit function: protected override void OnInit(EventArgs e) { ModuleConfiguration.ModuleControl.ControlTitle = Localization.GetString("Whatever", LocalResourceFile); base.OnInit(e); } Be sure to have Whatever.Text as the name for the string in the .resx file.
Oh wow... Now that I'm seeing this code sample, it's reminding me that this is something I USED to know! 🤣
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.