开发者

Get Customized Child Values into Grid using LINQ

I have the following three Tables...

PatientEligibilities

PatientEligibilitiesServiceItems

ServiceItems

The Relation Between Tables as following:

One to Many between : PatientEligibilities and PatientEligibilitiesServiceItems

One to One between : PatientEligibilitiesServiceItems and ServiceItems

I retrieved PatientEligibilitiesObject

I need to fill grid with PatientEligibilitiesServiceItems

i did the following:

dt = CreateDT("Code", "Description")
 If PatientEligibilityObject.PatientsEligibilitiesServiceItems.Count > 0 Then
         For Each LST In PatientEligibilityO开发者_高级运维bject.PatientsEligibilitiesServiceItems  
           Dim res = HMSData.ServiceItems.Single(Function(ds) ds.ID = LST.ServiceItemID)
           dt.Rows.Add(res.Code, res.EngName)
         Next
 Else
        dt.Rows.Add("", "")
 End If
       uwg.DataSource = dt

This solution is working fine.. but i believe it's not the Best Or even Good one..

i tried the following:

uwg.DataSource = PatientEligibilityObject.PatientsEligibilitiesDoctorsSpecialties.GetNewBindingList()  

It gave me all columns in the Table .. like ServiceItemID and also ServiceItem

But i need to get ServiceItem.Code and ServiceItem.EngName

How can I do that?


I keep the this solution since using direct binding from LINQ query to grid will be more complex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜