For the past 3 weeks, I've been grappling with a problem that has me stumped. I just can't seem to figure it out for the life of me. What I'm attempting to achieve is a specific output or presentation using tables.
Here's an example of what I'm aiming for:
This setup resembles a bracketing system for a kickball tournament. Here's how my model looks:
public class Match{
public int id {get;set;}
public int teamid1 {get;set;}
public int teamid2 {get;set;}
public int roundnumber {get;set;}
public int winner {get;set;}
}
Right now, I'm looping through the rounds. For instance, if there are four rounds, I would proceed as follows:
for(int r = 1; r < bracketRounds; r++){
for(int m = 1; m < roundMatches +1; m++){
matchGroup = "<tr><td>" + team1 + "</td></tr>"
+ "<tr><td>vs</td></tr>"
+ "<tr><td>" + team2 + "</td></tr>";
}
}
The issue here is that this code snippet only generates a single column table displaying all the matches. I'm seeking guidance on how to modify this approach so that subsequent rows can be inserted next to the initial row, creating a bracket-like layout.
Any help or pointers in the right direction would be greatly appreciated. Thank you!