Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
70
How to bind UltraGrid to master-child-grandchild collections?
posted

I am converting an application from a dataset bind of master-child-grandchild to a tuple of collections:

I am stuck trying to figure out how to do the binding between the lists to setup the master detail relationships.

Here is what I have ... showing the new code I have and the old code...

Tuple<List<UserClaimViewDto>, List<DocumentViewDto>, List<DocumentPageViewDto>> msg = VSCS.UserClaims.UserClaims.GetUserClaims2(historyDate, showAll);
var UserClaims = new BindingList<UserClaimViewDto>( msg.Item1 );
var documents = new BindingList<DocumentViewDto>( msg.Item2);
var pages = new BindingList<DocumentPageViewDto>(msg.Item3);

//???
// grdUserClaims.DataBindings.Clear();
// grdUserClaims.DataBindings.Add("Text", UserClaims, "UserClaimId");
// grdUserClaims.DataSource = UserClaims;


//dataset based code
var messages = m_objMessages.GetUserClaimMessages(historyDate, showAll);
// create producer/batch count relationship and add to DataSet
DataColumn[] dclParent = new DataColumn[1];
DataColumn[] dclChild = new DataColumn[2];
DataColumn[] dcldocumentPages = new DataColumn[2];

dclParent[0] = messages.Tables[0].Columns["UserClaimId"];

dclChild[0] = messages.Tables[1].Columns["UserClaimId"];
dclChild[1] = messages.Tables[1].Columns["DocumentId"];

dcldocumentPages[0] = messages.Tables[2].Columns["UserClaimId"];
dcldocumentPages[1] = messages.Tables[2].Columns["DocumentId"];

DataRelation relContractHistory = new DataRelation("userClaim", dclParent[0], dclChild[0]);
messages.Relations.Add(relContractHistory);

DataRelation relDocumentPages = new DataRelation("Pages", dclChild, dcldocumentPages);
messages.Relations.Add(relDocumentPages);

grdUserClaims.DataSource = messages;

Parents Reply Children
No Data