This is a migrated thread and some comments may be shown as answers.

Help in binding to grid

0 Answers 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Keith Stephens
Top achievements
Rank 1
Keith Stephens asked on 03 Jun 2010, 08:01 PM
Hello all,

I have inherited a hybrid asp.net c# and silverlight 3 web application.

The page I am working with has a tabcontrol and 5 grid controls. In the code-behind a collection of collections gets bound to the tabcontrol.

 tabControl1.ItemsSource = AgreementList;

 

AgreementList is an observable collection of agentagreements.

 

Agreementlist

      Agentagreement[0]

            Agent

                  Address

                  City

                  State

            Notes

                  AANote[0]

                        Lines

                              AANoteBody[0]

                                    LineText

                                    Seq_num

                              AANoteBody[1]

                                    LineText

                                    Seq_num

                        NoteNum

            HazRestrictions

                  AAHazrestictions[0]

                        Condition

                        UncCode

 

After I bind to the tab control, the grids bind to this collection by

<telerikGridView:RadGridView x:Name="gdvHazRestrict" HorizontalAlignment="Left" 
                                                             AutoGenerateColumns="False" 
                                                             ShowGroupPanel="False" 
                                                             IsFilteringAllowed="False" 
                                                             ItemsSource="{Binding HazRestrictions}" 
                                                             Width="450" FontFamily="Arial Narrow" FontSize="9">  
                            <telerikGridView:RadGridView.Columns> 
                                <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding UNCode}" Header="UNCode" /> 
                                <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Condition}" Header="Condition" /> 
                            </telerikGridView:RadGridView.Columns> 
                        </telerikGridView:RadGridView> <!-- Hazardous Restrictions Grid --> 
The above code works for getting my hazard codes;
Now I am wanting to get too the LineText, but my code is not working.  The results in the AgreementList collection for the Notes is one note with 2 lines of text.
But I think I am doing my binding wrong.
<telerikGridView:RadGridView x:Name="gdvNotes" 
                                                         AutoGenerateColumns="False" 
                                                         ItemsSource="{Binding Notes.Lines}" 
                                                         ShowGroupPanel="False" 
                                                         IsFilteringAllowed="False" 
                                                         Width="460">  
                            <telerikGridView:RadGridView.Columns> 
                                <!--<telerikGridView:GridViewColumn  Header="Note" Width="430" />--> 
                                <telerikGridView:GridViewDataColumn DataMemberBinding="{Binding LineText}"  Width="430" /> 
                            </telerikGridView:RadGridView.Columns> 
                        </telerikGridView:RadGridView> 
 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Keith Stephens
Top achievements
Rank 1
Share this question
or