Listview tag


Author
Message
Chan
Chan
Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)Advanced StrataFrame User (965 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have a table which PK is a composite key, char(10), datetime.

How to set this to listview.tag?



Thank you
Larry Caylor
Larry Caylor
StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)StrataFrame VIP (1.8K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

You can add a custom property to your business object that returns the object’s primary key value. This will cause the primary key value to be displayed in the list of possible tag values when you configure the list view. The custom property would look something like

 

 ''' <summary>

''' Compound Primary Key

''' </summary>

''' <remarks></remarks>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("CompoundPrimaryKey"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [PrimaryKey]() As MicroFour.StrataFrame.Business.PrimaryKeyValue

   Get

      Return Me.GetPrimaryKeyValue()

    End Get

End Property

 

Make sure you add the custom property descriptor so the property is bindable. While this will get you the results you’re looking for, I try to stay away from compound keys since they are not really supported by the database deployment toolkit.

 

-Larry

 

 

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Great answer Larry, thanks!  Just FYI, the DDT does now support compound primary keys so you can go down this road as well if you choose.  When in the DDT, just select more than one field to be a PK.


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