I need to design a razor frontend that displays events for a particular room on a webpage. The URL structure will be like /rooms/room-1. (that part works)
I have a backend that collects all the events scheduled for that particular room on that day, which is working fine. There might be up to 13 events scheduled for that room on a given day.
However, the display screen can only show a maximum of 5 events at once.
(Getting the rows to the ui works)
1.) Therefore, I need to implement a feature where the page automatically switches to the next 5 events after a certain number of seconds, in a loop, using a pagetransistion effect
I have 0 experience in frontend design, so where do I start?
Does anyone have a good example or know where I can find one? For someone with no experience in frontend, it's frustrating to search for something on Google when I'm not sure what things are called that I need to search for.
To only show a maximum of 5 events at once, you can use
Skip()andTake()method to implement paging. Refer to this article: Part 3, Razor Pages with EF Core in ASP.NET Core - Sort, Filter, PagingTo auto refresh the page after a certain number of seconds, you can use the
setInterval()method, it will call a function at specified intervals (in milliseconds).In the interval function, you can check whether the Next button is disabled or not, then based on the result to redirect to the next page or the first page.
PaginatedList.cs:
EventIndex.cshtml.cs:
EventIndex.cshtml:
The result as below:
Besides, you can display the event list in a partial page, then use the setInterval method and JQuery Ajax to load the partial page in the main page.
Here are some relate articles about use JQuery Ajax to load partial page, you can refer them:
ASP.Net Core Razor Pages: Load Partial View using jQuery AJAX
Partial Page Update with AJAX in Razor Pages