Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Engage Software - Training Partner for DotNetNuke
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

MadCap Software, Inc.
AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
Click here to go to dev.live.com for Windows Live developer resources
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Localize It! (L...  Localization of user controls inside a user control
Previous Previous
 
Next Next
New Post 2/20/2008 2:03 AM
Resolved
User is offline JiGong
32 posts
Thatz.com
10th Ranked


Localization of user controls inside a user control 

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 6:52 AM
User is offline Chuck R.
98 posts
10th Ranked


Re: Localization of user controls inside a user control 

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

Anyone????

 
New Post 2/20/2008 10:03 AM
User is offline William Severance
576 posts
www.wesnetdesigns.com
8th Ranked




Re: Localization of user controls inside a user control 

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
 
New Post 2/20/2008 10:43 AM
User is offline Chuck R.
98 posts
10th Ranked


Re: Localization of user controls inside a user control 
Modified By Chuck R.  on 2/20/2008 2:48:32 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 6:21 PM
User is offline JiGong
32 posts
Thatz.com
10th Ranked


Re: Localization of user controls inside a user control 
Modified By JiGong  on 2/20/2008 10:54:18 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 Previous
 
Next Next
  Forum  General DotNetN...  Localize It! (L...  Localization of user controls inside a user control
 


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.

 


"SalarO" Skinning Graphic Design Branding Services
SalarO develops packaged & custom skins for your DNN at prices you can afford. SalarO is also developing Module development, Hosting, Branding/Logo design as well as Content Transfer Services to complement the core skinning solutions.
www.salaro.com
Data Springs Inc. - Module Development
Data Springs is a leader in the DNN community offering high quality modules, custom module development, enhancements to the DNN core product and overall DNN support.
www.datasprings.com
XCESS expertise center b.v.
Custom made modules and complete solutions for the DNN framework. Maatwerk modules en complete webtoepassingen gebaseerd op het DNN framework.
www.xcess.nl

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP