This question is locked. New answers and comments are not allowed.
Hello, I have an issue that I would really love some help with. I will keep it simple and based around the center of issue.
Picture this; 4 tables in database with the following stuctures.
[AffectedParcels]
-AffectedParcelID (PK)
-LandValuationNo
-VolFol
-SurveyStatusID (FK to SurveyStatus Table)
[SurveyStatus]
-SurveyStatusID
-Description
[Aquisition]
-AquisitionID (PK)
-AffectedParcelID (FK to AffectedParcels Table)
-StageID (FK to Stage table)
[Stage]
-StageID (PK)
-Name
-Description
Now using WCF RIA and Silverlight with LINQtoSQL Data Model.
I have a GridView and DataForm (Telerik) and the DDS's that are linked to the Domain Service.
Now then, the GridView is bound to the AffectedParcel DDS and displays nicely.
The DataForm is also bound to it. However, I do not want to see foreign key values. I have applied the techniques to filter out the foreign keys and return a particular field from the table instead. Therefore, instaed of seeing a field with the SurveyStatusID, I now see a combo box with a list of all the Descriptions. I will show the code that I have applied in doing so.
The DataForm:
<telerik:RadDataForm Name="AffectedParcelDataForm" Height="350" Width="340" Margin="80,0,0,0"
Grid.Column="1" AutoEdit="false" AutoCommit="False" AutoGenerateFields="False"
Header="Affected Parcels"
ItemsSource="{Binding DataView, ElementName=affectedParcelDomainDataSource}"
ReadOnlyTemplate="{StaticResource APTemplate}"
EditTemplate="{StaticResource APTemplate}"
NewItemTemplate="{StaticResource APTemplate}" HorizontalAlignment="Left" MouseEnter="AffectedParcelDataForm_MouseEnter" VerticalAlignment="Top">
</telerik:RadDataForm>
The DataTeplate:
<DataTemplate x:Key="APTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<telerik:DataFormDataField Label="Valuation Number"
DataMemberBinding="{Binding LandValuationNo, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Label="Volume and Folio" Grid.Row="1"
DataMemberBinding="{Binding VolFol, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Label="Approximate AOT" Grid.Row="2"
DataMemberBinding="{Binding ApproxAreaOfTake, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Label="Final AOT" Grid.Row="3"
DataMemberBinding="{Binding FinalAreaOfTake, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Width="Auto" Grid.Row="4" Label="Survey Status">
<telerik:DataFormDataField.Content>
<telerik:DataFormComboBoxField
DataMemberBinding="{Binding SurveyStatusID, Mode=TwoWay}"
ItemsSource="{Binding DataView, Source={StaticResource SS}}"
SelectedValuePath="SurveyStatusID"
DisplayMemberPath="Description"/>
</telerik:DataFormDataField.Content>
</telerik:DataFormDataField>
</Grid>
</DataTemplate>
SS is the key for the SurveyStatusDomainDataSource.
Well that is all well and good. But when I try that same stunt with the Stage Field, then a real demom comes out. Why, Because adding the following code as a field in the DataTemplate:
<telerik:DataFormDataField Label="Stage" Grid.Row="5" >
<telerik:DataFormDataField.Content>
<telerik:DataFormComboBoxField x:Name="StageIDCombo"
DataMemberBinding="{Binding AffectedParcelID, Mode=TwoWay}"
ItemsSource="{Binding DataView, Source={StaticResource A}}"
SelectedValuePath="AffectedParcelID"
DisplayMemberPath="StageID" />
</telerik:DataFormDataField.Content>
</telerik:DataFormDataField>
Will in fact bring back the StageID associated with the affectedParcel from the Aquisition Table. But as you can see, it's an ID that comes back - something that I don't want to see. I would want to see the Stage Name or description from the Stage table. You see my issue here? If any one can ride with me on this one I would appreciate it.
Picture this; 4 tables in database with the following stuctures.
[AffectedParcels]
-AffectedParcelID (PK)
-LandValuationNo
-VolFol
-SurveyStatusID (FK to SurveyStatus Table)
[SurveyStatus]
-SurveyStatusID
-Description
[Aquisition]
-AquisitionID (PK)
-AffectedParcelID (FK to AffectedParcels Table)
-StageID (FK to Stage table)
[Stage]
-StageID (PK)
-Name
-Description
Now using WCF RIA and Silverlight with LINQtoSQL Data Model.
I have a GridView and DataForm (Telerik) and the DDS's that are linked to the Domain Service.
Now then, the GridView is bound to the AffectedParcel DDS and displays nicely.
The DataForm is also bound to it. However, I do not want to see foreign key values. I have applied the techniques to filter out the foreign keys and return a particular field from the table instead. Therefore, instaed of seeing a field with the SurveyStatusID, I now see a combo box with a list of all the Descriptions. I will show the code that I have applied in doing so.
The DataForm:
<telerik:RadDataForm Name="AffectedParcelDataForm" Height="350" Width="340" Margin="80,0,0,0"
Grid.Column="1" AutoEdit="false" AutoCommit="False" AutoGenerateFields="False"
Header="Affected Parcels"
ItemsSource="{Binding DataView, ElementName=affectedParcelDomainDataSource}"
ReadOnlyTemplate="{StaticResource APTemplate}"
EditTemplate="{StaticResource APTemplate}"
NewItemTemplate="{StaticResource APTemplate}" HorizontalAlignment="Left" MouseEnter="AffectedParcelDataForm_MouseEnter" VerticalAlignment="Top">
</telerik:RadDataForm>
The DataTeplate:
<DataTemplate x:Key="APTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<telerik:DataFormDataField Label="Valuation Number"
DataMemberBinding="{Binding LandValuationNo, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Label="Volume and Folio" Grid.Row="1"
DataMemberBinding="{Binding VolFol, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Label="Approximate AOT" Grid.Row="2"
DataMemberBinding="{Binding ApproxAreaOfTake, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Label="Final AOT" Grid.Row="3"
DataMemberBinding="{Binding FinalAreaOfTake, Mode=TwoWay}" Width="350" />
<telerik:DataFormDataField Width="Auto" Grid.Row="4" Label="Survey Status">
<telerik:DataFormDataField.Content>
<telerik:DataFormComboBoxField
DataMemberBinding="{Binding SurveyStatusID, Mode=TwoWay}"
ItemsSource="{Binding DataView, Source={StaticResource SS}}"
SelectedValuePath="SurveyStatusID"
DisplayMemberPath="Description"/>
</telerik:DataFormDataField.Content>
</telerik:DataFormDataField>
</Grid>
</DataTemplate>
SS is the key for the SurveyStatusDomainDataSource.
Well that is all well and good. But when I try that same stunt with the Stage Field, then a real demom comes out. Why, Because adding the following code as a field in the DataTemplate:
<telerik:DataFormDataField Label="Stage" Grid.Row="5" >
<telerik:DataFormDataField.Content>
<telerik:DataFormComboBoxField x:Name="StageIDCombo"
DataMemberBinding="{Binding AffectedParcelID, Mode=TwoWay}"
ItemsSource="{Binding DataView, Source={StaticResource A}}"
SelectedValuePath="AffectedParcelID"
DisplayMemberPath="StageID" />
</telerik:DataFormDataField.Content>
</telerik:DataFormDataField>
Will in fact bring back the StageID associated with the affectedParcel from the Aquisition Table. But as you can see, it's an ID that comes back - something that I don't want to see. I would want to see the Stage Name or description from the Stage table. You see my issue here? If any one can ride with me on this one I would appreciate it.