Products

Solutions

Resources

Partners

Community

About

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

HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...Localization of user controls inside a user controlLocalization of user controls inside a user control
Previous
 
Next
New Post
2/20/2008 6:03 AM
 

Hi All,

I have one main user control (Main.ascx). Inside the control, i have 2 other user control (ControlA.ascx and ControlB.ascx).

I am able to localize the label in Main.ascx.

QUESTION
------------

1. However, i am NOT able to do the same for the label in both ControlA.ascx and ControlB.ascx.I have already includes the resources files for the user control (Main.ascx.resx, ControlA.ascx and ControlB.ascx). I have checked the Name in *.resx and Name for my resourcekey. Both are correct (upper case and lower are correct).

2. Does the inherit PortalModuleBase, UserControlBase or PageBase effect the localization? All my control (Main.ascx, ControlA.ascx and ControlB.ascx) are using
inherits Entities.Modules.PortalModuleBase.

I have read the localization guide but i don't have a clue. Am i missing something here?

Thanks.
 
New Post
2/20/2008 10:52 AM
 

Excellent Question!!!!  I have the same problem and have been looking for an answer for two days.

Anyone????

 
New Post
2/20/2008 2:03 PM
 

In order to help I need answers to the following questions (which when asked may also lead you on your own to the solution):

1. Are ControlA.ascx and ControlB.ascx being loaded into Main.ascx using LoadControl or are they part of the delcarative markup (html, etc.) code for Main.ascx?

2. Are you localizing the controls (such as label) of ControlA and ControlB using a ResourceKey in the markup or are you calling one of the forms of Localization.GetString in the code behind?

3. If you are calling Localization.GetString are you using the overloaded method which includes the parameter for the LocalResourceFile, that is:

             MyLocalizedValue = GetString("MyKey", LocalResourceFile)

4. If so, have you set a break point in the debugger to check the value being returned for LocalResourceFile.  It should be of the form of:

             .  . . /DesktopModules/MyModuleFolderName/App_LocalResources/ControlA

5. If the value for LocalResourceFile does not include ControlA or ControlB at its end, you will need to have set the ID of the child control loaded with LoadControl to the name of the control or, set the value of ControlA and ControlB's LocalResourceFile property explicitely each time the control is loaded. You could also set the child controls's LocalResourceFile property to that of the Main.ascx control. In that case, localization values for each child control would be pulled from Main.ascx.resx rather than from separate ControlA.ascx.resx and ControlB.ascx.resx resource files.

6. Although not directly related to this problem, you'll also find it helpful to have set the ModuleConfiguration property of each child control to that of the main control immediately after the child control has been loaded.


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
2/20/2008 2:43 PM
 

Bill,

Thanks for your reply. I can't speak for 'JiGong' but I'm doing it in the markup.

I have a main control "ImageList.ascx" and a sub control "imageViewer2List.ascx". As you can see I load ImageViewer2List.ascx by registering it in ImageList.ascx. In ImaveViewer2List.ascx I have a resourcekey defined on an ASP:LAbelControl id="lblNoFilesFound". I set my resourcekey to "lblNoFilesFound".

No matter what resource file I put the entry in and no matter what I have tried as far as a key in the various files I still get no text. I even turned on the "ShowMissingKeys" option in web config and it then shows me "RESX:lblNoFilesFound.Text" as the key that it's looking for. Any help would be emensly appreciated!!!! Below is the code for my "main control.

Also, I already have code to initialize the sub-control's module settings from the main control.  I put it in the Page_Load of the sub-control (ImageViewer2List.ascx.vb.  Is that the correct place to put it?

 

Visual Basic
1
2
ctlImageList.ModuleConfiguration = Me.ModuleConfiguration

Any help would be emensly appreciated!!!!
Chuck R.

ASP.NET
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="ImageList.ascx.vb"
  Inherits="ISILM.DNN.Modules.LandRecords.ImageList" %>
<%@Register  Src="./ImageViewer2/ImageViewer2List.ascx" TagPrefix="isilm" TagName="ImageList"%>

<table cellspacing="0" cellpadding="2" border="0" width="100%">
  <tr>
    <td>
      <isilm:ImageList id="ctlImageList" runat="server"/>
    </td>
  </tr>
</table>
<p style="text-align:center;">
  <asp:LinkButton CssClass="CommandButton" ID="cmdReturn" resourcekey="cmdReturn" runat="server"
    BorderStyle="none" Text="Return"></asp:LinkButton>&nbsp;
</p>

Here is the code for my "sub-control"...

ASP.NET
1
2
3
4
5
6
<td style="text-align: center;" class="NormalRed">
        <asp:Label ID="lblNoFilesFound" runat="server" Visible="true"
          resourcekey="lblNoFilesFound"
        </asp:Label>
      </td>
 
New Post
2/20/2008 10:21 PM
 

Good Day Bill,

Good questions will lead good answers.

Thank you for the question. I have found my answer.

Here is the solution:

If you have user controls (let say controlA.ascx and controlB.ascx) within a user control (let say Main.ascx) and you want to localize the user controls, you can do the following step:

1. Register the controlA.ascx and controlB.ascx to Main.ascx using: <@Register TagPrefix ="MyControl" TagName="ControlA" src="ControlA.ascx">

2. To localize the label in ControlA.ascx, do the following

a. Put the resourcekey word to label

b. Add resource file for ControlA.

   Please note the name for the resource file is NOT ControlA.resx.ascx IT MUST follow the ID in the Main.ascx.

   So, in this case the file name is ucControlA.resx.ascx

3. In the ucControlA.resx, add lblTest.Text to Name column and (Your value) to value. That's all folk. Have a good day ahead.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...Localization of user controls inside a user controlLocalization of user controls inside a user control


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