DotNetNuke Modules – Labels w/ no Help

While the bulk of the labels you use on a module will be DotNetNuke labels, occasionally you want to be able to put text on the screen that doesn’t need context help and doesn’t need to be associated with a label. Instructions for a page are a good example of this. The problem becomes, how do we apply localization to these labels?

It’s actually pretty easy. You can add a resourcekey attribute to the ASP:Label control and DotNetNuke will look at it and use it to look in the resource file for a string.

So code that typically looks like this:

<asp:Label ID="label1"
runat="server">View Module</asp:Label>

Would become:

<asp:Label ID="label1"
runat="server" resourcekey="label1">View Module</asp:Label>

And the key you would place in the resource file would be label1.Text.

I tend to make my resourcekey the same name as the id of the control unless I’m actually using text in multiple places that will be exactly the same in each location even if it changes.

I also don’t use the actual text in between the opening and closing asp:Label tags. That way, when it runs, I can see that the text is being picked up correctly. In fact, most of the time, I just leave that blank.

 

Other post in DotNetNuke - Module Development

Related Post

  • DotNetNuke Modules – Creating Base ModulesDotNetNuke Modules – Creating Base Modules Now that we have DotNetNuke installed into Visual Studio we can go ahead and create our first modules. Actually, creating the modules is pretty simple. But it is even easier to do it wrong, which...
  • DotNetNuke – InternationalizationDotNetNuke – Internationalization One of the core features of DotNetNuke is that all of the text that shows up on a page either comes out of the database or out of resource files.  Anything that comes out of the resource files can ...
  • DotNetNuke Modules – LinkButtonsDotNetNuke Modules – LinkButtons As you can probably already guess, localizing a LinkButton in DotNetNuke is pretty straightforward. But you'll never guess what most people miss when they add this little control to their DotNetNuk...
  • DotNetNuke – Make Your Module SearchableDotNetNuke – Make Your Module Searchable So far, you know everything you need to know to get a basic module up and running. There are a few items we still need to cover regarding the configuration of your module so that it can have diffe...
  • DotNetNuke – Modules – Linking within the moduleDotNetNuke – Modules – Linking within the module Now that we have the module skeleton up and running and we have a data access layer, the next thing we need to look at is specific functions you may need to use from within your code. One of the m...