smartDBforms.NET API Reference

DataBindItem.FKParentTable Property

Gets the foreign key parent table. The table is used to show to the user all the foreign key values he can select from.

[Visual Basic]
Public ReadOnly Property FKParentTable As DataView
[C#]
public DataView FKParentTable {get;}

Remarks

Note    This property is available only if SupportsForeignKey is set to true.
The returned table has three special columns
Column Name Description
FK_CaptionColumn Holds the caption for each data row
FK_DescriptionColumn Holds the description for each data row
FK_ValueColumn Holds the string that represents the foreign key value for each data row

If the parent table has columns of type byte[]( 'image' in MS SQL Server) the columns' content is not returned.

Example

Here a drop down is filled with all available foreign key values. The FK_CaptionColumn as dropdown items' text.

<EditTemplate>
               
<asp:DropDownList ID="DropDownValue" runat="server" DataSource='<%# Eval("FKParentTable") %>' OnDataBound="DropDownList1_DataBound" DataTextField="FK_CaptionColumn" DataValueField="FK_ValueColumn" Enabled="<%# !DataBindItem.IsReadOnly %>" CssClass="field" TabIndex='<%# Eval("StartTabIndex") %>'>
</asp:DropDownList>
</EditTemplate>

See Also

DataBindItem Class | Adillis.SmartDBForms Namespace