i making webProject.
I'm making a web on a razor page.
A page -> B-page -> Apage I want to remember and keep the full scroll of page A when I return as above. But the example I found was a razor view and its queryselector didn't work
page transition from A to B
<a asp-page="./ViewBorad" asp-route-boradid="@Model.borad_tbl[i].tbl_Board.board_id"
My idea was to save it in tempdata and then call the data from onget.
[BindProperty]
public int ScrollPosition { get; set; }
public IActionResult OnGet()
{
if (TempData["ScrollPosition"] != null)
ScrollPosition = (int)TempData["ScrollPosition"];
}
how I thought
Problem) I don't know how to get the corresponding value in js and throw the corresponding scroll value to c# bindproperty access the cookie in js
Problem) When a button that calls a function in C# is pressed, the page is reloaded. If you use href='javascript:history.go(-1)', the reloading behavior is skipped
<input asp-page-handler="ChangeComplete" asp class="btn" type="submit" value="OK" style=" background-color: white;
float: right ; margin-left: 6px; "
href='javascript:history.go(-1)'/>