I am using a Functions class written in VB on my Razor Page. The page does what it is asked to do but the Next Date calculation is stuck on the first row.
@page
@model Moderate.Pages.DanceList.ThisCityModel
@using VB_Stuff.VB_Stuff;
Then I am building a table and displaying the data with a For Each loop.
<tbody>
@foreach (var item in Model.Dances_Moderated)
{
That is all fine and dandy and each new value per row is displayed except when I get to the column that calls the VB functions to calculate the "Next Date".
Only the first row's data is sent to the Next Date functions so as the For Each iterates through the numerous rows, the data does not change, only the first row's data is sent to the functions resulting in all rows displayed having that first value for that column. Other columns change base on data changing.
<td>
@{
DateStuff obj = new DateStuff();
string strTodayTomorrow = obj.fTodayTomorrow(Model.Dances_Moderated[0].RecurYesNo, Model.Dances_Moderated[0].SingleDate, Model.Dances_Moderated[0].RecurWeekOfMonth, Model.Dances_Moderated[0].RecurDayOfWeek);
if (strTodayTomorrow == "")
{
string NextEvent = obj.fNextEvent(Model.Dances_Moderated[0].RecurYesNo, Model.Dances_Moderated[0].SingleDate, Model.Dances_Moderated[0].RecurWeekOfMonth, Model.Dances_Moderated[0].RecurDayOfWeek);
@Html.Raw(NextEvent)
}
else
{
@Html.Raw(strTodayTomorrow)
}
}
</td>
Oh, and these Data math functions work flawlessly in several other VB.Net apps I have.