Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0resourcekey is not work in inner WebUserControl !!! resourcekey is not work in inner WebUserControl !!!
Previous
 
Next
New Post
11/26/2008 4:52 AM
 

i installed three languages in my dnn web. I used dnn 4.7. But another folder in Module like Controls i put some controls and and .resx files too.

but while changing Lang. inner controls lang. is not change. See this thread for more information

 Please help me out!!!

 
New Post
11/26/2008 6:45 AM
 

embedded usercontrols need to have their own resx files


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
11/26/2008 8:43 AM
Accepted Answer 

There are several ways to handle this:

1. As Erik indicated, an embedded user control which inherits PortalModuleBase can be given it's own resx file(s). In this case, note that the base name of the file should be that of the embedded control's ID. For example if the embedded user control has an ID of "ctlMyUserControl", the base name of the resx file must be "ctlMyUserControl.resx".

2. As in #1 above, set up your embedded user control to inherit the PortalModuleBase class as would any module control.  In the Page_Load of the parent control, set the embedded user control's LocalResourceFile propert to that of the parent:

ctlMyUserControl.LocalResourceFile = Me.LocalResourceFile

In this case, localization values will be pulled from the parent control's resx file.

3. If your embedded user control does not inherit from PortalModuleBase, define a Public ReadOnly Property LocalResourceFile and in the property's getter you can return the appropriate resource file name. For example:

Public ReadOnly Property LocalResourceFile As String
     Get
         Return Me.TemplateSourceDirectory & "/" & Services.Localization.Localization.LocalResourceDirectory & "/MyUserControl"
     End Get
End Property

In this case, the resx file should be named "MyUserControl.resx" and located in the App_LocalResources subfolder of the folder containing the usercontrol.

4. As a variation of #3, add a setter to the LocalResourceFile property of the embedded user control and set it to the parent's LocalResourceFile as in #2 above.

5. Finally, if appropriate in your case, place the needed localization strings in the module's App_LocalResources/SharedResources.resx file. I generally include a Public ReadOnly Property SharedResourcesFile in my module's Configuration class or in a module base class (inheriting from PortalModuleBase) so that I may obtain a reference to the path of SharedResources.resx from any control in the module.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
11/26/2008 10:45 AM
 

As a last resort, if none of the excellent options that William outlined above meet your needs, you may also elect to re-enable ASP.NET localization   I provide a custom BuildProvider with which to do so here.  Note that it should only be used if there is no DNN-centric method by which you may accomplish your goals.

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
11/28/2008 8:16 AM
 

thanks William for your valuable answer. And currently i implemented code for My controls which are not inherite from PortalModulebase.

i saw such a thing in Forums modules. It contain one custom control in Controls folder and in this module they code for localize text.

So thnks buddy.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0resourcekey is not work in inner WebUserControl !!! resourcekey is not work in inner WebUserControl !!!


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.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out