I got a function to which I provide an ID, which, in turn, returns a collection of results.
From these, I get yet another set of results, that I display in a datagrid.
With the code below I get the results from the Last Node that has Notes.
private void GetNotesList(int Id)
{
DataAccess.LexCodeNode LexCodeNode = new DataAccess.LexCodeNode();
LexCodeNode.Where.LexCodeId.Value = Id;
LexCodeNode.Query.Load();
for (int Index = 0; Index <= LexCodeNode.RowCount; Index++, LexCodeNode.MoveNext())
{
int LexCodeNodeId = LexCodeNode.LexCodeNodeId;
DataAccess.LexCodeNote LexCodeNote = new DataAccess.LexCodeNote();
LexCodeNote.Where.LexCodeNodeId.Value = LexCodeNodeId;
if (LexCodeNote.Query.Load())
{
BindGrid(DgNoteLst, LexCodeNote.DefaultView);
}
}
}
I know I should do something like
Array Notes = new Array();
for (int Index = 0; Index <= LexCodeNode.RowCount; Index++, LexCodeNode.MoveNext())
{
int LexCodeNodeId = LexCodeNode.LexCodeNodeId;
DataAccess.LexCodeNote LexCodeNote = new DataAccess.LexCodeNote();
LexCodeNote.Where.LexCodeNodeId.Value = LexCodeNodeId;
if (LexCodeNote.Query.Load())
{
Notes.Add(LexCodeNote);
}
}
BindGrid(DgNoteLst, Notes); // I should send Notes as a View..
My question is: How do I add these values to the DefaulView from each cycle.
private void BindGrid(DataGrid grid, DataView view)
{
grid.DataSource = view;
grid.DataBind();
}