AJAX

P

Peter Larsen [CPH]

Hi,

I have a ajax page where i want the page to scroll to the bottom of the page
on each update.
I have tried to use "#bookmarks" and "d.scrollIntoView(true);" scripts, but
it doesn't seems to be triggered on updates.

Is it possible to fire scripts on ajax updates or how should i fix this
scroll problem ??

Thank you in advance
Peter
 
V

Vince Xu [MSFT]

Hi,

Which Ajax Framework you used?

You can call javascript code "document.body.scrollTop =
document.body.scrollHeight;" in IE after page updated and call
"document.documentElement.scrollTop =
document.documentElement.scrollHeight;" in FireFox.

With Asp.Net Ajax, you can define pageLoad function to call this script
code.

function pageLoad(){
if(sys.browser.agent ===sys.browser.internetexplorer)
document.body.scrollTop = document.body.scrollHeight;
else
document.documentElement.scrollTop =
document.documentElement.scrollHeight;
}


--
Sincerely,

Vince Xu

Microsoft Online Support


==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================

--------------------
| From: "Peter Larsen [CPH]" <[email protected]>
| Subject: AJAX
| Date: Mon, 15 Feb 2010 10:56:42 +0100
| Lines: 14
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: edge1.bankinvest.dk 131.165.55.123
| Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:96459
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi,
|
| I have a ajax page where i want the page to scroll to the bottom of the
page
| on each update.
| I have tried to use "#bookmarks" and "d.scrollIntoView(true);" scripts,
but
| it doesn't seems to be triggered on updates.
|
| Is it possible to fire scripts on ajax updates or how should i fix this
| scroll problem ??
|
| Thank you in advance
| Peter
|
|
|
 
V

Vince Xu [MSFT]

Hi,
Since I didn't see your response. Does it work for you?

--
Sincerely,

Vince Xu

Microsoft Online Support
--------------------
| X-Tomcat-ID: 19864759
| References: <#[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Vince Xu [MSFT])
| Organization: Microsoft
| Date: Tue, 16 Feb 2010 07:44:18 GMT
| Subject: RE: AJAX
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 69
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:96485
| NNTP-Posting-Host: tk2tomimport1.phx.gbl 10.230.18.247
|
| Hi,
|
| Which Ajax Framework you used?
|
| You can call javascript code "document.body.scrollTop =
| document.body.scrollHeight;" in IE after page updated and call
| "document.documentElement.scrollTop =
| document.documentElement.scrollHeight;" in FireFox.
|
| With Asp.Net Ajax, you can define pageLoad function to call this script
| code.
|
| function pageLoad(){
| if(sys.browser.agent ===sys.browser.internetexplorer)
| document.body.scrollTop = document.body.scrollHeight;
| else
| document.documentElement.scrollTop =
| document.documentElement.scrollHeight;
| }
|
|
| --
| Sincerely,
|
| Vince Xu
|
| Microsoft Online Support
|
|
| ==================================================
| Get notification to my posts through email? Please refer to
| http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
|
| MSDN Managed Newsgroup support offering is for non-urgent issues where an
| initial response from the community or a Microsoft Support Engineer
within
| 2 business day is acceptable. Please note that each follow up response
may
| take approximately 2 business days as the support professional working
with
| you may need further investigation to reach the most efficient
resolution.
| The offering is not appropriate for situations that require urgent,
| real-time or phone-based interactions. Issues of this nature are best
| handled working with a dedicated Microsoft Support Engineer by contacting
| Microsoft Customer Support Services (CSS) at
| http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
| ==================================================
|
| --------------------
| | From: "Peter Larsen [CPH]" <[email protected]>
| | Subject: AJAX
| | Date: Mon, 15 Feb 2010 10:56:42 +0100
| | Lines: 14
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
| | X-RFC2646: Format=Flowed; Original
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
| | Message-ID: <#[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: edge1.bankinvest.dk 131.165.55.123
| | Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP05.phx.gbl
| | Xref: TK2MSFTNGHUB02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:96459
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | Hi,
| |
| | I have a ajax page where i want the page to scroll to the bottom of the
| page
| | on each update.
| | I have tried to use "#bookmarks" and "d.scrollIntoView(true);" scripts,
| but
| | it doesn't seems to be triggered on updates.
| |
| | Is it possible to fire scripts on ajax updates or how should i fix this
| | scroll problem ??
| |
| | Thank you in advance
| | Peter
| |
| |
| |
|
|
 
P

Peter Larsen [CPH]

Hi Vince Xu,

Thank you for your reply,
Does this work for ajax updates too ??

BR
Peter
 
V

Vince Xu [MSFT]

Hi Peter,


| Does this work for ajax updates too ??

If you mean ajax async request, it can be used in any scenario on client.
It's just the javascript code which is based on asp.net ajax.

--
Regards,

Vince

Microsoft Online Support
 
G

Guest

Hi,

I have a ajax page where i want the page to scroll to the bottom of the page
on each update.
I have tried to use "#bookmarks" and "d.scrollIntoView(true);" scripts, but
it doesn't seems to be triggered on updates.

Is it possible to fire scripts on ajax updates or how should i fix this
scroll problem ??

Thank you in advance
Peter

Peter,

it should be possible with scrollIntoView. Just check before it if d
is not null. Maybe this is your problem.

var d = document.getElementById('h1');
if (d != null)
d.scrollIntoView(true);

More at http://msdn.microsoft.com/en-us/library/ms536730.aspx

Hope this helps
 
V

Vince Xu [MSFT]

Hi,

Did you resolve it?

--
Regards,

Vince

Microsoft Online Support

--------------------
| X-Tomcat-ID: 11541696
| References: <#[email protected]>
<[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Vince Xu [MSFT])
| Organization: Microsoft
| Date: Thu, 25 Feb 2010 02:57:40 GMT
| Subject: Re: AJAX
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 7
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:96696
| NNTP-Posting-Host: tk2tomimport1.phx.gbl 10.230.18.247
|
| Hi Peter,
|
|
| | Does this work for ajax updates too ??
|
| If you mean ajax async request, it can be used in any scenario on client.
| It's just the javascript code which is based on asp.net ajax.
|
| --
| Regards,
|
| Vince
|
| Microsoft Online Support
|
|
|
 
P

Peter Larsen [CPH]

Hi,

First it didn't work for IE, but after changing the script a bit, it now
works for both browsers.
This is what i have:

function pageLoad() {
if(Sys.Browser.agent == Sys.Browser.InternetExplorer)
document.documentElement.scrollTop = document.body.scrollHeight;
else
document.documentElement.scrollTop =
document.documentElement.scrollHeight;
}

I have changed the IE part from "document.body.scrollTop =
document.body.scrollHeight" to "document.documentElement.scrollTop =
document.body.scrollHeight".

Thanks for your help.

BR
Peter
 
P

Peter Larsen [CPH]

Hi Alexey,

Using scrollIntoView() does work on first update, but nothing happens on the
following ajax updates.

/Peter

Hi,

I have a ajax page where i want the page to scroll to the bottom of the
page
on each update.
I have tried to use "#bookmarks" and "d.scrollIntoView(true);" scripts,
but
it doesn't seems to be triggered on updates.

Is it possible to fire scripts on ajax updates or how should i fix this
scroll problem ??

Thank you in advance
Peter

Peter,

it should be possible with scrollIntoView. Just check before it if d
is not null. Maybe this is your problem.

var d = document.getElementById('h1');
if (d != null)
d.scrollIntoView(true);

More at http://msdn.microsoft.com/en-us/library/ms536730.aspx

Hope this helps
 
G

Guest

Hi Alexey,

Using scrollIntoView() does work on first update, but nothing happens on the
following ajax updates.

/Peter







Peter,

it should be possible with scrollIntoView. Just check before it if d
is not null. Maybe this is your problem.

var d = document.getElementById('h1');
if (d != null)
d.scrollIntoView(true);

More athttp://msdn.microsoft.com/en-us/library/ms536730.aspx

Hope this helps

Hej Peter,

can you please give an example of your layout? It might be something
that "blocked" this from working. I've done similar tasks already with
scrollIntoView and had no problems.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top