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  |  

The best choice for your web site host, email hosting, and domain registration.
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Indoo
 


  Sponsors  

Meet Our Sponsors

Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  Language Packs ...  Localization of GridView Including CommandField Buttons
Previous Previous
 
Next Next
New Post 4/19/2008 3:31 AM
User is offline Mazen
23 posts
10th Ranked


Re: Localization of GridView Including CommandField Buttons 

Hi, that's a pretty nice piece of code, i've tried and it worked but it's acting somewhat in my code irregularly can you help me out here? where should i load this function beside the page_load? i put it in the _selectedIndexChanged for each gridview but the text for the command keep switching each time i press select for example  between the default language (US) and the language i'm translating to and the columns header disapear completely !!!!! 

Thank you.

Mazen.

 
New Post 4/23/2008 12:34 AM
User is offline shashi
4 posts
10th Ranked


Re: Localization of GridView Including CommandField Buttons 

Hi...

Please let me know what does the localization.getsting wil do?

Is there any method called GetString in your application?

How u r catching the key pair of a resource file?

 

Please respond fast......

 

Thnx in advance.

 William Severance wrote

Needing to localize a GridView control's header text as well as the captions on the buttons in a CommandField, I wrote the following:

Public Shared Sub LocalizeGridView(ByVal gv As GridView, ByVal ResourceFile As String)
     Dim key As String
     Dim localizedText As String
     Dim pi As System.Reflection.PropertyInfo

     For Each col As DataControlField In gv.Columns
           key = col.HeaderText
           If key <> "" Then
               localizedText = Localization.GetString(key & ".Header", ResourceFile)
               If localizedText <> "" Then
                   col.HeaderText = localizedText
               End If
           End If

           'Localize text of Cancel, Delete, Edit, Insert, Select, New, Update buttons
           If TypeOf col Is CommandField Then
                Dim cmdField As CommandField = DirectCast(col, CommandField)
                For Each cmdName As String In New String() {"Cancel", "Delete", "Edit", "Insert", "Select", "New", "Update"}
                      pi = cmdField.GetType.GetProperty(cmdName & "Text", GetType(String))
                      key = CType(pi.GetValue(cmdField, Nothing), String)
                      If Not String.IsNullOrEmpty(key) Then
                          localizedText = Localization.GetString(key & ".CommandText", ResourceFile)
                          If localizedText <> "" Then
                               pi.SetValue(cmdField, localizedText, Nothing)
                          End If
                      End If
               Next
          End If
     Next
End Sub

In the local resource file, the keys for Header text should end with .Header while the keys for the CommandField button captions should end with .CommandText. In a CommandField, the EditText, CancelText, etc. default to "Edit", "Cancel", etc. so unless the defaults are overridden in the CommandField declaration, use keys of "Edit.CommandText", "Cancel.CommandText", etc. in the resource file.

I'm not sure if my use of reflection in getting and setting the captions of the CommandField buttons is the most efficient performance wise, it was quick to write using fewer statements.

Hope this is helpful to someone!

 
New Post 4/23/2008 2:37 AM
User is offline Sebastian Leupold
12957 posts
www.deutschnetnuke.de
1st Ranked












Re: Localization of GridView Including CommandField Buttons 

shashi, please check the Localisation Whitepaper and the Module Development Localization Guide, both available from Resources > Documentation > Downloads page in the menu above.


Sebastian Leupold



DotNetNuke Project UserDefinedTable
DotNetNuke Project XML/XSL
 
New Post 4/23/2008 3:36 AM
User is offline shashi
4 posts
10th Ranked


Re: Localization of GridView Including CommandField Buttons 
Hi.... Thnks fr ur response...I had read the document. But im srry to say tht...i cudnt find the answer . Please tel me as how u'll get the particular key from the resource file. The Getstring method you used is nt present in the document. So please let me know. Thnks in advance shashi
 
New Post 4/23/2008 5:51 AM
Online now... ErikVB
2601 posts
www.apollo-software.nl
5th Ranked










Re: Localization of GridView Including CommandField Buttons 

shashi, Localization.Getstring is a DNN Framework method, part of the Localization Class.

Anyhow, i am not quite sure i am following your question. Can you please elaborate as to why it is you are asking this question? (so we can answer your question better....)


Erik van Ballegoij, Apollo Software
If what i am saying is wrong: blame Google
MLSkinHelper: the easy way to put editable text in your skin!
Nederlandse DotNetNuke Gebruikersgroep Apollo Software
 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  Language Packs ...  Localization of GridView Including CommandField Buttons
 


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.

 


DNNMasters - modules, consulting, development
DNNMasters developers are involved in DNN development since DNN 1.0.9 and today we offer a broad range of DNN related products and services including custom development of modules, help with ing third party modules for specific needs, general DNN technical support and administrative services.
www.dnnmasters.com
Cygnusoft Custom Software
Cygnusoft has been providing cutting-edge custom software solutions for 20 years. Cygnusoft is also a leading start-up incubator, helping our partners build successful new businesses.
www.cygnusoft.com
Digicon: DotNetNuke design and development
Digicon is based in Brisbane, Queensland, Australia
digicon.com.au

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