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 use resource file for gridview How to use resource file for gridview
Previous
 
Next
New Post
6/2/2008 1:24 PM
 

I have a custom developed module .Now i want to use a resource file for my user control .The user control has a gridview ,formview and few other label controls .How to localise them ?Any ideas ? Please help me out .Thanks

 
New Post
6/2/2008 1:33 PM
 

You will want to look at the Localization Guide that is available from the documentation section of this site.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
6/2/2008 1:40 PM
 

Call in pageload:

LocalizeGridView(GridView1, LocalResourceFile)

and put this somewhere:

 

        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


Yehuda Tiram
AtarimTR
AtarimTR
972-2-5700114   |   972-54-4525492   |    http://www.atarimtr.co.il
 
New Post
6/2/2008 9:23 PM
 

At the time I wrote the code provided by Yehuda Tiram, the core did not provide a means to localize the GridView control. However, this capability (plus the localization of DetailsView controls) was added to DNN version 4.6.0 and above:

In the class DotNetNuke.Services.Localization.Localization:

Public Shared Sub LocalizeGridView(ByRef gridView As GridView, ByVal resourceFile As String)

Public Shared Sub LocalizeDetailsView(ByRef detailsView As DetailsView, ByVal resourceFile As String)

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
6/3/2008 12:41 AM
 

Hi Bill,

Sorry for not giving you the credit. I just found the code somewhere a long time ago and kept it.

Yehuda


Yehuda Tiram
AtarimTR
AtarimTR
972-2-5700114   |   972-54-4525492   |    http://www.atarimtr.co.il
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Language and In...Language and In...How to use resource file for gridview How to use resource file for gridview


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