The following submits an array of strings to an asp.net razor page for handling. It is not straightforward how to submit an array for processing. You have to first stringify it before sending with ajax. Once it is received, you have to then deserialize it into a List.. Suppose you have an array of strings: […]
Ensuring important information below an image is visible.
In creating responsive web sites, we sometimes want to put a photo at the top of the page, but still ensure that the user sees important text below the photo at first glance. Otherwise, the user might not know that there is important information he should scroll to. We can use flex boxes and viewport […]
Example of copying a file to another folder on a Razor page
If you want to copy files between folders on Razor pages, open each file as a FileStream and use the CopyTo method. I created a new IActionResult called OnGetChangeFolder() that resides in my Index page code. To execute it, I call https://example.com/?handler=changefolder I have a folder of cities, each one identified by its name. In […]
Example of adding a spinner to a fetch on a react site
If you need to fetch data from a server while the user is viewing a webpage, you need to give the user an indication that the fetch is occurring and that the webpage is not frozen. Spinners are the perfect solution. You can show the user spinning circles, dots, bars, hearts and any other type […]
Example of a javascript fetch to a razor page
In this example, we have a database of tours with id, name, price, and other information. We would like to pull just the name and the price of the tour using a javascript fetch to a site hosting the razor pages. We will use the index page on the server site and assume it has […]