Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
how to maintain scrollbar in razor page

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"];
}
  1. how to save scrollbar value in asp-page part in bind property
  2. how to access BindProperty in js part

how I thought

  1. When switching from page A to page B, call js and store the current scrollbar position in cookie When you load page A again after doing so, if there is a cookie, it goes to that location.

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

  1. Utilizing Back When you use Back, the page's scroll bar is automatically remembered.

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)'/>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!