It is easy to change the title of a module programmatically, something like
<code>private void Page_Init(object sender, System.EventArgs e){<br /> ModuleConfiguration.ModuleTitle = "Whatever";<br /> }</code>
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
I found somethng in an old code I wrote some years ago:
<code>protected override void OnPreRender(EventArgs e)<br /> {<br /> ModuleContext.Configuration.ModuleTitle = Localization.GetString("Whatever", LocalResourceFile);<br /> base.OnPreRender(e);<br /> }</code>
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:
<code>protected override void OnPreRender(EventArgs e)<br /> {<br /> ModuleContext.Configuration.ModuleControl.ControlTitle = Localization.GetString("Whatever", LocalResourceFile);<br /> base.OnPreRender(e);<br /> }</code>
No luck. Anyone who can bring light into the darkness? Is it a bug?
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: [code] protected override void OnInit(EventArgs e) { ModuleConfiguration.ModuleControl.ControlTitle = Localization.GetString("Whatever", LocalResourceFile); base.OnInit(e); } [/code] 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 for the discussion of the open source CMS DNN platform and ecosystem.
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.