I am getting data in following format from Datatable as
Protection_1.Record.Trip.TripRecord1.Year
Protection_1.Record.Trip.TripRecord1.Month
Protection_1.Record.Trip.TripRecord1.Date
Protection_1.Record.Trip.TripRecord1.Hour
Protection_1.Record.Trip.TripRecord1.Min
Protection_1.Record.Trip.TripRecord1.Sec
Protection_1.Record.Trip.TripRecord1.mSec
Protection_1.Record.Trip.TripRecord1.Pickup_Setting_String
Same needs to plotted using tree in Treeview.
What I have tried:
I tried to build following logic
TreeNode node = null;
TreeNodeCollection nodes = Treeview1.Nodes;
for (int i = 0; i <= max_row; i++)
{
string combination = Convert.ToString(FinalDT.Rows[i]["tag_name"]);
string[] data = combination.Split('.');
TreeNodeCollection nodes = TV_TagList.Nodes;
foreach (string name in data)
{
if (nodes.ContainsKey(name))
{
node = nodes[name];
}
else
{
node = new TreeNode(name);
node.Name = name;
nodes.Add(node);
}
nodes = node.Nodes;
}
}
Same works for windows application but not for web application.
the mentioned for loop code works fine at windows application end. the same logic when tried in asp.net, containskey property is not part of Treenodecollection hence the logic fails. I need help to find out an alternate way to populate tree view using above mentioned example as input from datatable
Kindly help to get this resolved.