Hi,
I've got a gridview with a 3level hierarchy.
When loading the view with :
first level: 300 elements
second level: 10 elements
third level: 5 elements
the load goes fast.
But if I'm trying the following load:
first level: 2100 elements
second level: 10 elements
third level: 5 elements
the load goes slow...
I think I had to wait for 10 - 15 minutes before everything was loaded.
Is this due to bad programming or something else?
my code:
Is it possible that the lines 12 and 28 are the bad ones?
the first one is checking if I have unique elements and the second one is calling a static function to concatenate a list of strings.
Thanks a lot in advanced
I've got a gridview with a 3level hierarchy.
When loading the view with :
first level: 300 elements
second level: 10 elements
third level: 5 elements
the load goes fast.
But if I'm trying the following load:
first level: 2100 elements
second level: 10 elements
third level: 5 elements
the load goes slow...
I think I had to wait for 10 - 15 minutes before everything was loaded.
Is this due to bad programming or something else?
my code:
var sortedByLft = from c in network | |
where (c.Rgt - c.Lft) == 1 | |
orderby c.Name ascending | |
select c; | |
var checkNetwork = new List<Network>(); | |
//display the unique items in the gridview | |
foreach (var item in sortedByLft) | |
{ | |
Application.DoEvents(); | |
//check if item is already added | |
var check = checkNetwork.Find(p => p.Adserver_id == item.Adserver_id); | |
if (check != null) continue; | |
checkNetwork.Add(item); | |
Application.DoEvents(); | |
rgvAdlPositions.MasterGridViewTemplate.Rows.Add(new object[] { item.Adserver_id, item.Name }); | |
var template = rgvAdlPositions.MasterGridViewTemplate.ChildGridViewTemplates[0]; | |
foreach(var position in item.Positions) | |
{ | |
Application.DoEvents(); | |
//get the method as string | |
var method = Enums.GetMethod(position.Method); | |
//add to row | |
template.Rows.Add(new object[] | |
{ | |
item.Adserver_id, position.PosId, | |
ownFunctions.ConcatStrings(new List<string> | |
{ | |
position.Name, | |
position.Width.ToString(), | |
"x", | |
position.Height.ToString() | |
}), | |
method | |
}); | |
var templateAd = template.ChildGridViewTemplates[0]; | |
foreach(var adPos in position.adserverPositions) | |
{ | |
//add adserved position to row | |
templateAd.Rows.Add(new object[] { item.Adserver_id, position.PosId, adPos.name }); | |
} | |
} | |
} |
Is it possible that the lines 12 and 28 are the bad ones?
the first one is checking if I have unique elements and the second one is calling a static function to concatenate a list of strings.
Thanks a lot in advanced