StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



BrowseDialog - How to show in list the value...Expand / Collapse
Author
Message
Posted 06/14/2008 1:17:19 AM


StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 12:58:48 AM
Posts: 71, Visits: 129
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

Everything is possible, just keep trying...

Post #17056
Posted 06/14/2008 11:37:36 AM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:09:13 PM
Posts: 536, Visits: 2,211
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

 
Post #17063
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 7:23pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 12 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.