Click here to Skip to main content
15,923,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello to all
i implemented a post section like facebook using a datalist named outer datalist and inside this datalist i am using another datalist named inner datalist for comment section. Outer datalist is inside a panel in which i am using scrolling position vertical, when i post 5 post the scrolling works,All operation of update comment, delete comment, like etc are working fine but when i enters any comment in comment section and as i click send button the scroll bar goes from top . I am using update panel and some java script for fixed scrollbar but they are not same that what i want here. i want java script which prevents scroll bar to goes top when i'll fire any event like update,edit,delete etc in inner datalist.
please help me.
Posted

1 solution

Hai ,

Please go through this link

http://stackoverflow.com/questions/4210798/how-to-scroll-to-top-of-page-with-javascript-jquery[^]

It's may helpful for you. And also i check with following sample it's work for in all browsers.

XML
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function myfunction() {
            $('yourpanelidhere').scrollTop(0);
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button Text="text" runat="server" OnClientClick="myfunction()" />
        <div id="checking" style="height: 150px; width: 50px; overflow-x: hiddem; overflow-y: auto;">
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
            sometext
            <br />
        </div>
    </div>
 
Share this answer
 

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