0

I have a page with 100 products. When the product is clicked, I add the product info to the cart with session.

I'm sending the id of the product to the session with the querystring.

response.redirect("shop.aspx?id=2")

When the user clicks on the product, my page is refreshed because it sends a querystring to the page and the page position goes to the top.

MaintainScrollPositionOnPostback="true"

not work for me cause i use response.redirect();

thats my problem. Thanks all =(

Eren
  • 1

1 Answers1

0

I explain the solution.

if u guys using ' html a tag or Response.Redirect() ' Delete all.

use PostBackUrl

<asp:Button ID="Button1" PostBackUrl="~/WebForm1.aspx?id=3" runat="server" Text="Submit" />

At the top of your .aspx codefile, insert the following:

 MaintainScrollPositionOnPostback="true"

Like this

<%@ Page Language="C#" MaintainScrollPositionOnPostback="true" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"

Thats all <asp:Button ID="Button1" PostBackUrl="WebForm1.aspx?id=<%#Eval(id)%>" runat="server" Text="Submit" />

I wish you good work

Eren
  • 1
  • You start out by saying You will explain, but then You do not, instead You just show. By looking at the question it is clear that there are some basic comprehension of concepts that the asker needs to understand. Perhaps drop a link to page lifecycle or whta not to add to the explanatory parts – T. Nielsen Jul 29 '22 at 06:33