Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Master Detail - Linq to SQL - is it posible?

  •  06-25-2008, 8:35 AM

    Master Detail - Linq to SQL - is it posible?

    I have a linq to sql dbml file with a tblEquipment table and a tblEquipmentLog table with a one-to-many relationship. I want to drill down to see the equipmentlog for each piece of equipment.

    As in the linq to sql example i query the databse like this:

            public rglEquipmentDataContext db = new rglEquipmentDataContext();       

            private IEnumerable<tblEquipment> eQuery = null;
            public IEnumerable<tblEquipment> qEquipment
            {
                get
                {
                    if (eQuery == null)
                    {
                        eQuery = from e in db.tblEquipments
                                  select e;
                    }
                    return eQuery;
                }
            }

     In my XAML i have CollectionViewSource like this.

            <xcdg:DataGridCollectionViewSource x:Key="cvsEquipment"
                                               Source="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=qEquipment}"
                                               AutoFilterMode="And" 
                                               DistinctValuesConstraint="Filtered">
     

     I've added AutoCreateDetailConfigurations="True" to the grid

    I've also added                

    <xcdg:DataGridControl.DetailConfigurations>
                        <xcdg:DetailConfiguration RelationName="tblEquipment_tblEquipmentLog"
                                      Title="Equipment Log">
                            <xcdg:DetailConfiguration.Columns>
                                <xcdg:Column FieldName="eqlID"
                               Visible="False" />
                                <xcdg:Column FieldName="eqlUser"
                               Visible="True" />
                            </xcdg:DetailConfiguration.Columns>
                        </xcdg:DetailConfiguration>
                    </xcdg:DataGridControl.DetailConfigurations> 

     What else do i need to do to make it work.

    Thanks in advnace for you help.

    Filed under: ,
View Complete Thread
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.