Learn More





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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesIssues LocalizeString and adding DNN controls in aspxIssues LocalizeString and adding DNN controls in aspx
New Post
3/26/2015 5:09 PM

I'm experiencing a very odd behaviour, both starting with ChristoC templates (latest version for VS2012) or starting a project from scratch. I experience this strange issue and I tried everything but couldn't come up with a solution.

I inehrit in code behind from a basepage class I made, which in turn inherits from PortalModuleBase. Now in code behind i can successfully use LocalizeString(String) function but if I try to use the same function in .aspx with <%=LocalizeString("BasicSettings")%> I get this error "LocalizeString is not declared. It may be inaccesible..."

This is very odd since in code behind of the same page I can use it without issues.


Second problem I have is always in aspx code. I try to reference DNN controls to use them in the code that way:

<%@ Register TagPrefix="dnn" TagName="label" Namespace="DotNetNuke.UI" Src="~/controls/LabelControl.ascx" Src="~/controls/LabelControl.ascx" %>

Error: "....File Not Found".

If I switch the path from ~/ to ../../ it seems to work fine. PS. Removing  Namespace="DotNetNuke.UI" gives another error.

Even in this situation I tested many things and read around but didn't come to a solution yet. In the project properties (Web Application) I set web option to use Local IIS set to and override application root URL set to


I really don't know what else to try and why I have such behavior. I can understand I could have such issues trying to start from scratch on my own, maybe overlooking some setting somewhere, but I'm having same issues with a fresh install of ChristoC templates.


Thanks in advance for your support


New Post
3/26/2015 6:50 PM
Hi Max,

Regarding your first question, I don't normally localize things that way, but I think you need to reference the localization namespace in your file directly. Personally, I would either use the built-in DNN localization methods or do it from the code.

To use a built in method, you use the "resourcekey" attribute. So, you can just replace your <%=LocalizeString("BasicSettings")%> with an asp:label with the attribute resourcekey="BasicSettings"... and then DNN will take care of it for you.

On the second problem, that's not actually a problem when you run the module in a DNN site. What's happening is that Visual Studio is looking for the user control in that directory within your solution. It can't find it so it shows that warning. When you place the module in a DNN site, that path points to the control, and the module works normally.

Hope this helps,

New Post
3/27/2015 7:04 PM

Thank you for your fast answer Mike!

So you are saying that if I use default .NET resource attributes for localization, DNN will handle the check for portal/host localizations?
Still the problem remains because it seems I cannot access any PortalSettings function in ascx code while I can access them without problems in code behind of the very same page. It's like the ascx code isn't aware of the inheritation of the base class.
How could it be?

New Post
4/4/2015 5:06 PM

I tried several tests but it seems I still canno access PortalModuleBase functions and properties in my .ASCX markup, while I can use them without issues in code behind.

The inheritance chain is: PortalModuleBase > MyCustomBase > AscxPage

I also tryed the direct inheritance PortalModuleBase > AscxPage but I'm experiencing the same behaviour, in code behind of the ascx control I can access all PortalModuleBase stuff, but in the markup code, using <% %> I cannot access anything. I tried using the Me. qualifier as well (VB) but with no luck.

DId you experience something similar? Any solution? To make this work that would not include redifining dummy properties and functions in code behind just to passs the inherited ones? Thanks

EDIT: There must be some other general issue going on for me because it seems I cannot access nothing declared in my code behind from the associated ascx markup... help! :)

New Post
4/4/2015 5:49 PM
When does it fail and how? Is your problem that visual studio gives you wavy lines and no intellisense? Or does it fail when you actually run it?

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesIssues LocalizeString and adding DNN controls in aspxIssues LocalizeString and adding DNN controls in aspx

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.
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?