Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-15-2012, 08:58 PM   PM User | #1
dejanc
New to the CF scene

 
Join Date: Feb 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dejanc is an unknown quantity at this point
How to keep scrollbar position while Timer is updating UpdatePanel? To check code.

Hello,
I need help.
I'm testing aps.net controls. I have add Repeater with some content. Repeater is inside of Panel which has Vertical ScrollBars. Timer1 is updating Repeater. As I need scrollbar on PageLoad on the bottom of Panel control, I have add javascript.
But, now problem is each time when try to move scrollbar up, Timer push it down. But, I would like somehow to keep in position if move it. I have try it with javascript code OnMouseOver with _StopTimer, but it effect only when mouse is over asp.net cotrol, not it's scrollbar.

Any idea? Note: I have been Googling, Yahooing many ours, and try different codes, but none was working. So, really need some new approach.
Note: MaintainScrollPositionOnPostback="true" is already added on page.

Thank you in advance for help.

Code:
<asp:ScriptManager ID="ScriptManager1" runat="server"/> 
    <script type="text/javascript"> 
        if (Sys != null) { 
            var instance = Sys.WebForms.PageRequestManager.getInstance(); 
 
            if (instance != null) { 
                instance.add_endRequest(function (sender, args) { 
                    SetScroll() 
                }); 
            } 
        } 
 
         function pageLoad() {
            window.onload = SetScroll;
        }
 
        function SetScroll() { 
            var objDiv = document.getElementById("<%=Panel1.ClientID%>"); 
            objDiv.scrollTop = objDiv.scrollHeight; 
        } 
 
     
 
</script> 
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> 
    <ContentTemplate> 
    <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label> 
          <asp:Timer ID="Timer1" runat="server" Interval="1000"> 
          </asp:Timer> 
           </ContentTemplate> 
    </asp:UpdatePanel> 
 
<asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Height="193px"  
        Width="467px" BorderColor="#66CCFF" BorderStyle="Solid" BorderWidth="1px"> 
    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"> 
    <ContentTemplate> 
<asp:Repeater ID="Repeater1" runat="server"> 
    <ItemTemplate> 
    <div style="font-family: calibri; color: #000099;"> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
             TEST 
                </BR> 
               </asp:Repeater>  
</ContentTemplate> 
    <Triggers> 
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> 
</Triggers> 
    </asp:UpdatePanel> 
      </asp:Panel>
dejanc is offline   Reply With Quote
Reply

Bookmarks

Tags
asp.net, javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:20 PM.


Advertisement
Log in to turn off these ads.