DejanDejanovic
Programmer
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.
<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>
<aspanel 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>
</aspanel>
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.
<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>
<aspanel 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>
</aspanel>