Hi
I have below data
| Group 2C |
| Group 2C(i) |
| Group 3C |
| Group 3D |
| Group 3D(i) |
| Group 3E |
| Group 3G |
I want to display like below
Group 2C , Group 2C(i)
Group 3C
Group 3D , Group 3D(i)
Group 3E
Group 3G
BALGroup bALGroup = new BALGroup();
List objGroup = bALGroup.GetGroupList("Group");
if (objGroup != null)
{
List GroupCollection = new List();
foreach (var colum in objGroup)
{
GroupCollection.Add(colum.GroupName.ToString());
}
}
Thanks
Amit MohantyPosted Jun 13, 2023, 10:15 AM
Brahma Prakash ShuklaPosted Jun 27, 2023, 8:27 AM
BALGroup bALGroup = new BALGroup(); objGroup = bALGroup.GetGroupList("Group"); GroupCollection = new List();
List
if (objGroup != null)
{
List
string currentGroup = null;
foreach (var column in objGroup)
{
string groupName = column.GroupName.ToString();
if (groupName.StartsWith("Group"))
{
if (currentGroup != null && groupName.Contains("("))
{
GroupCollection.Add(currentGroup + " , " + groupName);
}
else
{
if (currentGroup != null)
{
GroupCollection.Add(currentGroup);
}
currentGroup = groupName;
}
}
else
{
if (currentGroup != null)
{
GroupCollection.Add(currentGroup);
currentGroup = null;
}
GroupCollection.Add(groupName);
}
}
if (currentGroup != null)
{
GroupCollection.Add(currentGroup);
}
// Now you can use the GroupCollection list as desired
}