Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my shopping cart project, I have a datalist with 2 columns and 30 rows. There is an
'addtocart' button for each product. When a button is clicked, and when the user rolls his mouse
to view other items in other rows, the vertical scroll bar moves upwards towards that already
clicked product. It seems it happens because of that 'addtocart' button click event. How to stop
this scroll movement? I have kept this 'addtocart' button inside an update panel too.



<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="DT.aspx.cs" Inherits="DT" Title="Untitled Page" MaintainScrollPositionOnPostback="true" %>

XML
<asp:UpdatePanel ID="dd" runat="server" >
  <ContentTemplate>
  <asp:TextBox ID="AddToCartTB"  runat = "server" Text='1' BackColor=GhostWhite style=" margin-left:11px" Width="34px"  > </asp:TextBox>
  <asp:Button ID="AddToCart"  runat = "server" Text='Add to Cart'  ForeColor="#333333"  BackColor="#ffcc66" Width="100px"  Style=" margin-top:-22px; margin-left:100px; font-family:Arial"  commandname="myevent">
  </asp:Button>
  </ContentTemplate>
  </asp:UpdatePanel>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900