I'm attempting to bind a Grid (programmatic-approach) through LINQ. Here is the scenario: I have a table of clients. Every client has branches and coordinators. They have more collections but I don't want to expose them. I want to show the clients in a grid with different filtering criteria. For every client, the row expands to two tabs: Branches and Coordinators
The sub rows in the Branches View and Coordinator View must NOT be further expandable.
I want to select the columns to be shown in the Branches and Coordinators Details View.
I have tried these two approached with no success:
The first one produces the desired result in short time but the results are uncontrolled. I cant prevent deep-drilling, Tabs names, and Columns. The second one produces liners results and hence that fails as well. And the second one takes massive time...
Can anyone guide on this?
Objective: Create Master details grid with full control of all Column Headers (Master + Detail), All details Tabs Names
The sub rows in the Branches View and Coordinator View must NOT be further expandable.
I want to select the columns to be shown in the Branches and Coordinators Details View.
I have tried these two approached with no success:
RadGridViewSearch.DataSource = from pharms
in
DbContext.Pharmacies
where pharms.IsActive && pharms.Branches.Count > 0
orderby pharms.Name
select
new
{
pharms.OID,
pharms.Name,
pharms.PhoneNumber,
AddressInfo = String.Format(
"{0} {1} {2} {3}"
,
pharms.Contact.Addresses.FirstOrDefault().HouseNumber ??
String.Empty,
pharms.Contact.Addresses.FirstOrDefault().Street ??
String.Empty,
pharms.Contact.Addresses.FirstOrDefault().Area ??
String.Empty,
pharms.Contact.Addresses.FirstOrDefault().PostCode ??
String.Empty),
CityName = pharms.Contact.Addresses.FirstOrDefault().City.Name,
pharms.Branches,
pharms.PharmacyCoordinators
};
RadGridViewSearch.DataSource = from pharms
in
DbContext.Pharmacies
from branches
in
pharms.Branches.DefaultIfEmpty()
from coords
in
pharms.PharmacyCoordinators.DefaultIfEmpty()
where pharms.IsActive && pharms.Branches.Count > 0 && pharms.PharmacyCoordinators.Count > 0
orderby pharms.Name
select
new
{
ClientOID = pharms.OID,
ClientName = pharms.Name,
ClientPhoneNumber = pharms.PhoneNumber,
ClientAddressInfo =
string
.Format(
"{0} {1} {2} {3}"
,
pharms.Contact.Addresses.FirstOrDefault().HouseNumber ??
string
.Empty,
pharms.Contact.Addresses.FirstOrDefault().Street ??
string
.Empty,
pharms.Contact.Addresses.FirstOrDefault().Area ??
string
.Empty,
pharms.Contact.Addresses.FirstOrDefault().PostCode ??
string
.Empty),
ClientCityName = pharms.Contact.Addresses.FirstOrDefault().City.Name,
BranchOID = branches.OID,
BranchName = branches.BranchNumber,
BranchPhoneNumber = branches.PhoneNumber,
BranchAddressInfo = String.Format(
"{0} {1} {2} {3}"
,
branches.Contact.Addresses.FirstOrDefault().HouseNumber ??
String.Empty,
branches.Contact.Addresses.FirstOrDefault().Street ??
String.Empty,
branches.Contact.Addresses.FirstOrDefault().Area ??
String.Empty,
branches.Contact.Addresses.FirstOrDefault().PostCode ??
String.Empty),
BranchCityName = branches.Contact.Addresses.FirstOrDefault().City.Name,
CoordinatorOID = coords.OID,
CoordinatorName = coords.FirstName +
" "
+ coords.LastName,
CoordinatorCell = coords.MobileNumber,
CoordinatorEmail = coords.Email
};
The first one produces the desired result in short time but the results are uncontrolled. I cant prevent deep-drilling, Tabs names, and Columns. The second one produces liners results and hence that fails as well. And the second one takes massive time...
Can anyone guide on this?
Objective: Create Master details grid with full control of all Column Headers (Master + Detail), All details Tabs Names