Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

117
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda