Register    Login
 
 
ProductsDNN KickStartDNN KickStart ManualTips and TricksLookup fields
 
 
 
 
How to use localized data within lookup fields Minimize


In this case we want to try to create a module that will show data in a lookup box.
The data in the lookup box should be localized.
This means that for every locale defined (en, fr, nl) the data is shown for the locale the portal is presented in.

Download case
DNN KickStart module definitions for this case can be downloaded from the
downloads page.


Building blocks

  • Create secondary (lookup) module with localized data to lookin
  • Create primary module with lookup field to lookup data
  • Modify the primary sql and code to enable dynamic retrieval of data
  • Create a new stored procedure to lookup data with a locale parameter field
  • Modify the stored procedure to check if locale field exists
  • Return the data to the primary module

Create lookup module

Create main module

 

Create a lookup field

That will look like this in the module:

New stored procedure
Create a new stored procedure to retrieve the data from the lookup field based on a parameter filled with the locale.

We have to use a trick called:
Select statement with dynamic columns based on data content.

More inside information can be found on this site about this topic.

Check if locale field exists

More inside information can be found on this site about this topic.

Print  
 
Reference links Minimize
Stored procedure en parameters
Hoe maak je een stored procedure met een een reeks van parameters, die vanuit VB.net worden doorgegeven(arraylist).Het aantal parameters is niet altijd gelijk. Voorbeeld : Een gebruiker wil alle leden selecteren uit 2 verschillende gemeenten , een andere gebruiker wil alle leden selecteren uit 5 verschillende gemeenten.Deze selectie wil ik laten gebeuren vanuit één stored procedure.
Print  
 
Modify DataProvider Minimize

Search in your dataprovider file for this function and add this text:

#Region "Lookup data providers"

MustOverride Function myContactsLookupmyGroupItemItemCode() As IDataReader

#End Region

new text:

#Region "Lookup data providers"

Public MustOverride Function myContactsLookupmyGroupItemItemCode() As IDataReader
Public MustOverride Function myContactsLookupmyGroupItemItemCode(ByVal lanCode As String) As IDataReader

#End Region

Print  
 
Change ModuleController Minimize

add this function to your moduleController file (a modified copy of the existing one): 

Public Function myContactsLookupmyGroupItemItemCode(ByVal lanCode As String) As ArrayList

Dim infoList As ArrayList = Nothing
Dim idr As IDataReader = Nothing

Try

   idr = DataProvider.Instance().myContactsLookupmyGroupItemItemCode(lanCode)
   infoList = CBO.FillCollection(idr,
GetType(myContactsLookupmyGroupItemItemCodeInfo))

Finally

If Not idr Is Nothing Then

   idr.Close()
   idr.Dispose()
   idr =
Nothing

End If

End Try

Return infoList

End Function

text

 

Print  
 
Modify SQLDataProvider Minimize

Add the new function also to the dataProvider module:

 

#Region "Lookup data providers"

Public Overrides Function myContactsLookupmyGroupItemItemCode() As IDataReader

Return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("myContactsLookupmyGroupItemItemCode"))

End Function

 

Add the new function also to the dataProvider module:

 

#Region "Lookup data providers"

Public Overrides Function myContactsLookupmyGroupItemItemCode() As IDataReader

Return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("myContactsLookupmyGroupItemItemCode"))

End Function

Public Overrides Function myContactsLookupmyGroupItemItemCode(ByVal lanCode As String) As IDataReader

Return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("myContactsLookupmyGroupItemItemCodeByLanCode", lanCode))

End Function

#End Region

Print  
 
Modify SQL Creation script Minimize

Add this stored procedure:

 

create procedure {databaseOwner}[{objectQualifier}FRENTONLINE_myContactsLookupmyGroupItemItemCodeByLanCode]

@LanCode char

as

select

Item,

ItemCode

from {objectQualifier}FRENTONLINE_myGroup

where LanCode = @LanCode

GO

 

This concludes the stored procedures

Print  
 
 

 
 
 
 
 
 
Home|Company|Products|Contact|Forum|Downloads|Knowledge base|Shop
Copyright (c) 2010 FRENT IT Terms Of Use Privacy Statement March 12, 2010