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 12: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 2:45 AM
 

embedded usercontrols need to have their own resx files


Erik van Ballegoij, Technology Lead and Evangelist for DotNetNuke corporation, based in Amsterdam, The Netherlands.

Everything I say on these forums is my own opinion and does not necessarily reflect that of DotNetNuke Corp.
Check out the training sessions at DotNetNuke world. Learn from the Experts!
 
New Post
11/26/2008 4: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
Extensions Forge Projects - UserExport, ContentDeJour, ePrayer and ImageEditorControl
 
New Post
11/26/2008 6: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 4: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 !!!


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me
DotNetNuke Store

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Telerik JustCode Free
Exact Target Exec Alert
PowerDNN

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.