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

[Solved] Populate DataGrid with C#

1 Answer 122 Views
Data Storage for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 26 Jun 2013, 04:14 PM

I am writing to ask how best a DataGrid can be populated programmatically, in C#;

The code is calling out to a WCF Service application, and brings back results in a list;

The below code displays an error of "cannot convert type string to DataGridColumn"

Any insight, guidance is appreciated;

scData = new Service4Client(); 
var newTestSC = await scData.GetVWScorecardAsync(capFMFY, capGeoName, capSegment);
scI
= newTestSC.Count;

for (int i = 0; i < scI; i++)
{ for (int j = 0; j < 5; j++)
    {
        this.rdgVWAccounts.Columns[j] = newTestSC[i].MetricDisplayName;
    }
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosy Topchiyska
Telerik team
answered on 27 Jun 2013, 11:37 AM
Hi Robert,

Thank you for your question.

When you retrieve the data list from the service application, you have to convert the list to collection of business objects where each object represents a row and each property of the object represents a column within the grid. More information may be found in our online documentation.

I hope this helps. Let me know if you have any other questions.

Regards,
Rositsa Topchiyska
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Data Storage for XAML
Asked by
Robert
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or