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.0problem in using resources defined in .resxproblem in using resources defined in .resx
Previous
 
Next
New Post
4/4/2008 4:21 AM
 

hello

I am using DNN 4.8.2. My module contains many user controls. I have created *.ascx.resx file for each user control.

I want to use resource for .ascx page  defined in  corresponding .resx file.

suppose my General.ascx.resx file contain following Key value pair

key->lbl_Name,value->Name

&  General.ascx page contains asp Label  & I want assign above resource string to Text property of Label

  I tried following ways but nothing is working,Every thing Failed

          1.        Text='<%= Resources.lbl_Name%>'           //for this it doesnt show any thing

           2.        Text='<%$  Resources.lbl_Name%>'         //for this it throws exception saying that object lbl_Name is not found

          3.         Text='<%= Resources:lbl_Name%>'         //for this it doesnt show any thing

          4.         Text='<%$ Resources:lbl_Name%>'       //for this it throws exception saying that object lbl_Name is not found

          5.       Text='<%$ Resources:General,lbl_Name%>'   //for this it throws exception saying that object lbl_Name is not found

 

Any knows Solution then Please Let me Know

Help Me

-Snehal

 

 
New Post
4/4/2008 12:48 PM
 

Hi Snehal,

DNN disables most modern asp.net resource functionality and implements this internally.  This is because DNN needed localization before asp.net provided it satisfactorily, and so the core team rolled their own.  It is unfortunate that both methods aren't enabled by default side-by-side.  DNN does the disabling via the web.config:

<buildProviders>

     <remove extension=".resources" />

     <remove extension=".resx" />

</buildProviders> 

Because the extension is removed, Asp.net does not compile your resources.  Thus the errors.

Given this, you have a couple options:

1) Just use the DNN stuff.  Look in DotNetNuke.Services.Localization namespace.  Additionally, PortalModuleBase provides some local lookup methods.

2) Enable Asp.net localization side-by-side with DNN.  I refused to accept that DNN disabled built-in asp.net resource handling for my usercontrols, so I re-enabled it.  This was a moderately difficult task, and I'm not sure I would recommend it to everyone.  Let me know if you're interested in this route, and I will elaborate on the steps required.

Hope this helps!

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
4/6/2008 11:54 PM
 

Thanks Brandon.

I would like to use the resource file as I am having lots of pages and don't want to hard code any strings in either HTML or code behind file. I am interested in second approach, enabling ASP.NET localization. Though couldn't understand why DNN disabled this feature, as long enabling is not hampering the usual way DNN works, I think there should not be any issue. Please elaborate on how to do this. Again re-citing the requirements here:

1. I would like to create either single resource file for all the pages in my module or separate resource file for each page (<pagename>.ascx.resx)

2. Use these resources in my HTML code for all the controls.

3. Use the resource strings in code behind file and avoid hardcoding of messages.

Awaiting for your immediate response.

Thanks,

Snehal

 
New Post
4/8/2008 11:07 AM
 

Hi Snehal,

I'm working to document the steps necessary to re-enable the ASP.NET 2.0 localization in a DNN install.  I should have something for you later today.

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
4/8/2008 12:25 PM
 

Snehal,

please read DotNetNuke Module Developement Localization Guide, how to use a sharedResources.resx file for your module.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0problem in using resources defined in .resxproblem in using resources defined in .resx


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