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

HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...How to cuse a single resource file for multiple .ascx filesHow to cuse a single resource file for multiple .ascx files
Previous
 
Next
New Post
2/22/2008 9:22 AM
 

Hi,

I have a resource file that has resource names and their values which i need to use across the project. Project contains multiple .ascx files. I want to use the resource strings all over the project. Till now, i haven't found exact solution of that. I have used resourcekey keyword but i does not picks value from the resource file. I placed the file in App_GlobalResources, in 'Resources' folder, in App_LocalResources (project level), but none of them worked.

Any idea!

 

 
New Post
2/22/2008 11:10 AM
 

you can place resource keys, that are used by multiple controls of your module, in a shared resource file, called "SharedResources.resx


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
2/25/2008 1:32 AM
 

I placed the resource keys in SharedResources.resx file (placed under Resources folder) but when i use a resource string using ResourceKey="anyresourcekey", no text is shown at the place where i used resource key. e.g,

<dnn:labelcontrol id="lblLanguages" runat="server" ResourceKey="lblLanguages.Text" >

'lblLanguages.Text' is resource key inside the resource file. I also tried to use following syntax but it doesn't worked (It works fine in standard asp.net application)

<asp:Literal ID="Literal1" runat="server" Text="<%=Resources: MyResourceFile, lblLanguages.Text%>" />

The only thing that works is when resource file is placed in association with control in App_LocalResources folder by following syntax (which is not needed in my scenario). for example

<asp:TextBox ID="txtRedirectURL" runat="server" CssClass="abc" meta:resourcekey="txtPhoneNumberResource1" MaxLength="255"></asp:TextBox>

It would be nice if you list down all the steps in detail including how to use the resource key. I may be missing some step. Please note that our application is Module based.

 
New Post
2/27/2008 2:31 AM
 

Hi All,

That worked. Here is the detail.

In order to have a single resource file to be used in all project, string must be entered in SharedResources.resx (remeber to use the file already placed under App_GlobalResources folder. This folder can be found under the root project name).

In order to use the strings defined in that file, we can use the following syntax.

<asp:Label ID="lblFeatures" runat="server" resourcekey="lblFeatures.Text" />

resourcekey works on most of the asp controls and dnn label control but not all of them. It may show you an underline (error) but the 'Build' will succeed.

Currently i am searching how to have your own .resx file and using strings from it both in .ascx and .vb (or .cs) file.

Any idea!

 
New Post
2/28/2008 7:47 AM
 

Hi All,

After some R&D, i have found how to use resources from single file in our .vb or .cs files. Here is the example

DotNetNuke.Services.Localization.Localization.GetString("mykey.Text", ResolveUrl("~\App_GlobalResources\ResourceFileName.resx"))

Resourcefilename.resx can be SharedResources.resx or any other file you need to use.

Now currently the problem left is to use our own resource file (in App_GlobalResources folder) in *.ascx file.

Any idea!

 

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...How to cuse a single resource file for multiple .ascx filesHow to cuse a single resource file for multiple .ascx files


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