I'm trying to list events in a gridview and expand each gridview row to see which members who is related to these events/nodes.
protected void FindTheGridAndBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.DataRow) return;
GridView nestedGridView = (GridView)e.Row.FindControl("GridViewNested");
DataTable table = new DataTable();
DataColumn myDataColumn = new DataColumn();
myDataColumn.AllowDBNull = false;
myDataColumn.AutoIncrement = true;
myDataColumn.AutoIncrementSeed = 1;
myDataColumn.AutoIncrementStep = 1;
myDataColumn.ColumnName = "nested_auto_ID";
myDataColumn.DataType = System.Type.GetType("System.Int32");
myDataColumn.Unique = true;
table.Columns.Add(myDataColumn);
myDataColumn = new DataColumn();
myDataColumn.ColumnName = "member_id";
myDataColumn.DataType = System.Type.GetType("System.String");
table.Columns.Add(myDataColumn);
myDataColumn = new DataColumn();
myDataColumn.ColumnName = "member_name";
myDataColumn.DataType = System.Type.GetType("System.String");
table.Columns.Add(myDataColumn);
DataRow dataRow;
Node specificNode = new Node(1248);
Nodes events = specificNode.Children;
RelationType member2doc = RelationType.GetByAlias("coming");
foreach (Node year in events)
{
foreach (Node month in year.Children)
{
foreach (Node eventNode in month.Children)
{
if (eventNode.NodeTypeAlias == "Event")
{
Relation[] relations = Relation.GetRelations(eventNode.Id, member2doc);
Member member;
foreach (Relation relation in relations)
{
member = new Member(relation.Child.Id);
dataRow = table.NewRow();
dataRow["member_id"] = member.Id;
dataRow["member_name"] = member.Text;
table.Rows.Add(dataRow);
}
}
}
}
}
nestedGridView.DataSource = table;
nestedGridView.DataBind();
}
But I think it's listing members related to each event/node .. so the same person is added multiple times.. How can I list each member only once for each event?
I think I'm using the same datatable values for each master-gridview row, so I get the same values in the nested gridview.
List members related to node (an event)
Hi..
I'm trying to list events in a gridview and expand each gridview row to see which members who is related to these events/nodes.
But I think it's listing members related to each event/node .. so the same person is added multiple times..
How can I list each member only once for each event?
I think I'm using the same datatable values for each master-gridview row, so I get the same values in the nested gridview.
The Content structure looks like this:
/Bjarne
An example of the functionality I want is here: http://dotnetspeaks.com/LiveDemos/ASP.NET/GridView/NestedGridViewPaging.aspx
with events in the master gridview and the related members to each event in the nested gridview.
/Bjarne
How can I create a row foreach member in the relations and not foreach relation?
is working on a reply...