Datalist line break when records with same ID detected
-
20-08-2019 - |
Question
Kinda hard to explain, but i'll try. I have a datalist that is populated by a call to a stored procedure. The thing is, when rows with the same ID is detected i want it to break and add it under the first record and so on....
Illustration -- > Stack [23,45,566,676,787,878,23,23] (these represent record ID's)
23
23
23
45
and so on.
Currently it's adding a row to a different data item as show below.
23
23
23
Thanks in advance
Solution
One idea would be during the row databinding, check the current value, value previous, and next value. If you have a match between the current and previous, you have a group, then check the next row to come (from your original data source) and if it is different, then insert your empty line.