Requirements |
|
RadControls version |
|
.NET version |
|
Visual Studio version |
|
programming language |
|
browser support |
all browsers supported by RadControls |
DataColumn parentColumn = gl_dsLayerLOBsWIN.Tables["PriceLayerWin"].Columns["Layer"];
DataColumn childColumn = gl_dsLayerLOBsWIN.Tables["PriceLayerLOBWin"].Columns["Layer"];
DataRelation relation = new DataRelation("parent2Child", parentColumn, childColumn);
gl_dsLayerLOBsWIN.Tables[
"PriceLayerLOBWin"].ParentRelations.Add(relation);
radGridView_Layers.DataSource = gl_dsLayerLOBsWIN.Tables[
"PriceLayerWin"];
radTreeView_Layers.RelationBindings.Add(
new RelationBinding("PriceLayerWIN_PriceLayerLOBWIN", gl_dsLayerLOBsWIN));
radTreeView_Layers.DataSource = gl_dsLayerLOBsWIN;
Initially Dataset is empty. When I add a row to Parent datatable and a couple of rows to Child Datatable I see only first level node(s).... I do not see sublevels.
Could you , please help me with this.
I tried to use Gridview for this purpose also and tried to group it, but I still do not see any data for sublayers .. may be I'm missing something ...
Thank you ,
Victoria.
private void BuildTreeFromBindingSourceData()
{
this.monitorRadTreeView.Nodes.Clear();
int companyBindingSourcePosition;
int plantCompanyBindingSourcePosition;
int equipmentPlantBindingSourcePosition;
RadTreeNode companyNode;
RadTreeNode plantNode;
RadTreeNode equipmentNode;
if (companyBindingSource.Count > 0)
{
companyBindingSourcePosition = 0;
while (companyBindingSourcePosition <
companyBindingSource.Count
)
{
companyBindingSource.Position
=
companyBindingSourcePosition
;
companyNode
=
new
RadTreeNode();
companyNode.Text = ((MonitorInterfaceDBDataSet.CompanyRow) ((DataRowView)companyBindingSource.Current).Row).Name;
companyNode.Tag = ((MonitorInterfaceDBDataSet.CompanyRow)((DataRowView)companyBindingSource.Current).Row).ID;
companyNode.ShowCheckBox
=
false
;
if (plantCompanyBindingSource.Count > 0)
{
plantCompanyBindingSourcePosition = 0;
while (plantCompanyBindingSourcePosition <
plantCompanyBindingSource.Count
)
{
plantCompanyBindingSource.Position
=
plantCompanyBindingSourcePosition
;
plantNode
=
new
RadTreeNode();
plantNode.Text = ((MonitorInterfaceDBDataSet.PlantRow)((DataRowView)plantCompanyBindingSource.Current).Row).Name;
plantNode.Tag = ((MonitorInterfaceDBDataSet.PlantRow)((DataRowView)plantCompanyBindingSource.Current).Row).ID;
plantNode.ShowCheckBox
=
false
;
if (equipmentPlantBindingSource.Count > 0)
{
equipmentPlantBindingSourcePosition = 0;
while (equipmentPlantBindingSourcePosition < equipmentPlantBindingSource.Count)
{
equipmentPlantBindingSource.Position = equipmentPlantBindingSourcePosition;
equipmentNode = new RadTreeNode();
equipmentNode.Text = ((MonitorInterfaceDBDataSet.EquipmentRow)((DataRowView)equipmentPlantBindingSource.Current).Row).Name;
equipmentNode.Tag = ((MonitorInterfaceDBDataSet.EquipmentRow)((DataRowView)equipmentPlantBindingSource.Current).Row).ID;
equipmentNode.ShowCheckBox = true;
plantNode.Nodes.Add(equipmentNode);
equipmentPlantBindingSourcePosition++;
}
}
companyNode.Nodes.Add(plantNode);
plantCompanyBindingSourcePosition++;
}
}
this.monitorRadTreeView.Nodes.Add(companyNode);
companyBindingSourcePosition++;
}
}
}
companyBindingSource = new BindingSource();
companyBindingSource.DataSource = monitorInterfaceDBDataSet;
companyBindingSource.DataMember = "Company";
plantCompanyBindingSource = new BindingSource();
plantCompanyBindingSource.DataSource = companyBindingSource;
plantCompanyBindingSource.DataMember = "FK_Plant_Company";
equipmentPlantBindingSource = new BindingSource();
equipmentPlantBindingSource.DataSource = plantCompanyBindingSource;
equipmentPlantBindingSource.DataMember = "FK_Equipment_Plant";
Hello
I am attempting to bind 3 tables of data to a Treeview using lists:
vwMarketTypex mtype = markettypecontroller.GetView(STR_MarketType, STR_TimePeriod); |
List<Symbol> currencies = Symbolcontroller.GetSymbolsByMarketType(mtype.MarketTypeID); |
List<Scenario> scenarios = senariocontroller.GetAllScenarios(); |
List<RZEROMarketData.Data.RuleSet> rulesetsx = rscontroller.GetAllRulesets(); |
radTreeView1.RootRelationDisplayName = "Curreny Pair"; |
var newRelationBinding = new RelationBinding("Scenarios", scenarios, null, "ScenarioDescription", "ScenarioId"); |
radTreeView1.RelationBindings.Add(newRelationBinding); |
var newRelationBinding1 = new RelationBinding("Rulesets", rulesetsx, null, "Name", "RulesetId"); |
radTreeView1.RelationBindings.Add(newRelationBinding1); |
radTreeView1.DataSource = currencies; |
The last object rulesetsx does not bind ..please can you advise if I am on the right track.
Thanks