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

Leave a Reply

Comment Policy:

  • You must verify your comment by responding to the automated email that is sent to your email address. Unverified comments will never show.Leave a good comment that adds to the conversation and I'll leave your link in.
  • Leave me pure spam and I'll delete it.
  • Leave a general comment and I'll remove the link but keep the comment.

Notify me of followup comments via e-mail

Bear