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

GridView display correct number of rows, but no data

1 Answer 20 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dexter
Top achievements
Rank 1
Dexter asked on 13 Mar 2014, 07:43 AM
Hi, I'm trying to pass a list into GridView. It always display the correct number of rows according to the list I pass in, but all cells are blank. Any idea why this is so?

<telerik:RadGridView x:Name="gridCommsEqp" CanUserDeleteRows="False" ItemsSource ="{Binding}" AutoGenerateColumns="False" CanUserInsertRows="False" IsSynchronizedWithCurrentItem="True" ColumnWidth ="Auto" Width ="500" Margin="488,23,62,262" CanUserResizeRows="True" IsReadOnly="True" MouseDoubleClick="gridCommsEqp_MouseDoubleClick">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=SSN}" Header="SSN" UniqueName="SSN" TextWrapping="Wrap"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Description}" Header="Description" UniqueName="Description" TextWrapping="Wrap"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=CurrentQty}" Header="CurrentQty" UniqueName="CurrentQty" TextWrapping="Wrap"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=TotalQty}" Header="TotalQty" UniqueName="TotalQty" TextWrapping="Wrap"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Assemblage}" Header="Assemblage" UniqueName="Assemblage" TextWrapping="Wrap"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=UI}" Header="UI" UniqueName="UI" TextWrapping="Wrap"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

Dictionary<string, List<CommsEqp>> sd = new Dictionary<string, List<CommsEqp>>();
            sd = issueAdapt.getAllCommsEqp();
            gridCommsEqp.DataContext = sd["nonSetEquips"];
        }
//gridCommsEqp.DataContext = issueAdapt.getAllCommsEqp().DefaultView.Table;



Above are my codes. The last line, which is the commented codes, works if I get "issueAdapt.getAllCommsEqp()" to return a DataTable.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 20 Mar 2014, 04:31 PM
Hi Dexter,

It seems that your problem is caused by the wrong data member binding path of the RadGridView's Columns. You can check for binding errors in the output window during debug mode. Are you sure that the data context is set correctly?

Can you see the attached project and tell me if this is your problem?

Regards,
Hristo
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
GridView
Asked by
Dexter
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or