'Is it possible to assign a table data to a table header in HTML?

I'm working with tables in C# ASP.NET atm displaying data from an API. I have a problem where if a data doesn't exit / null I display nothing

                @foreach(var venue in Model.Venues)
                {
                    if(venue.id != location.venueId)
                    {
                        continue;
                    }
                    else
                    {
                        <td>@venue.venueName</td>
                    }
                }

If I add (<td>Null</td>) inside the if statement where venue.id != location.venueId. I get something like this... Where my table constantly expands until it ends or it finds something. It works perfectly if the data is there.

enter image description here

If I don't add anything to display as data I get something like this... An empty data which makes sense in every way. But I'm wondering if it is possible to assign table data to a table header so it keeps the empty spot for when the data does exist.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source