BrowseDialog - How to show in list the value of other table


Author
Message
Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi

I have a BrowseDialog properly configurated and working fine.

My question is if it's possible show a value in one column that comes from another related table.

Example:

I have a Countries table and a States table, each one has a unique ID and a text field, in the states maintenance form I add a BrowseDialog and add two search fields, one is a combo that retieves the names of the countries and another a text box for the name of the states.

Both works fine. What I want is in the list result, I want to show the name of the country because actually has the ID and the name of the city.

Thanks in advance for your valuable help.

Regards

Smile Everything is possible, just keep trying...

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Juan Carlos Pazos (06/14/2008)
Hi

What I want is in the list result, I want to show the name of the country because actually has the ID and the name of the city.

Thanks in advance for your valuable help.

Regards

Hi Juan Carlos,

Sure you can.  In the main StatesBO create a Custom Property CountryName, this property will have code to get the country name based on the StateBO.CountryFK, then in the Dialog Browser add the CountryName property to be shown in the ListView.  Of course, first re-build the BO library project or the solution so the new property will show up in the designers.

Here is a sample pseudo code that will get you started...

Protected Overrides Function GetCustomBindablePropertyDescriptors() As FieldPropertyDescriptor()

     ' Create and return a new array of FieldPropertyDescriptor objects that contains

     ' the ReflectionPropertyDescriptor for the Custom Fields.

     Return New FieldPropertyDescriptor() _

          {New ReflectionPropertyDescriptor("CountryName", GetType(StatesBO))}

End Function

 

''' <summary>

''' This property will return the Insurance Company Name

''' </summary>

''' <value></value>

''' <returns></returns>

''' <remarks></remarks>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("Country Name"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [CountryName]() As System.String

     Get

          If String.IsNullOrEmpty(Me.FK_Country) Then

               Return String.Empty

          End If

          Dim loLookupBO As New CountryBO

          loLookupBO.FillByPrimaryKey(Me.FK_Country)

          If loLookupBO.Count = 1 Then

               Return loLookupBO.CountryName

          Else

               Return String.Empty

          End If

     End Get

End Property

There are a lot information about Custom Field Properties in the help file and in these forums, so please check it out for better technical understanding.  This is just another feature I fall in love to Tongue

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search