Auto scroll the page?

G

Guest

Hi All,
i have problem to scroll the page the the specific section of the page after
click a command button.

I have tried using <a name="f"> and use response.redirect("xxxx.aspx?#f").
Although it works but i dont wan to reload the page.

I also used hyperlink to goto the "f" section. It works good without fire an
event (which cause reload page) but, the problem, i wan to click on a command
button and not the hyperlink.

So, how to accomplish it by clicking only the command button and direct me
to the "f" section without fire any event.

Any ideas? guiline?

Thank you in advance.
Best regards,
OCurnos
 
P

Pavan

Hi,

As far as my understanding, you are using asp.net command button to scroll
the page. If so, use HTML button instead.

And in page_Init event, add the following code.

(Let us say name of the HTML Button is btnScroll)

Protected void Page_Init(object sender, EventArgs e)

{

btnScroll.Attributes.Add("Href","xyz.aspx?#f");

}

I hope this will help you.

Regards,

Pavan
 
S

S. Justin Gengo

Daniel,

If you'd like some already working code I have a "ScrollToElement" method in
a Javascript component that I give away free on my website (everything there
is free). If you click on the "Code Library" link at the top of
www.aboutfortunate.com and then click the "Javascript" button in the menu on
the left you can download all source code for the component as a Visual
Studio.Net 2003 project. Even if you don't want to use the whole javascript
component (it has a lot of other useful scripts in it) you could always
strip out the ScrollToElement code. It lets you specify what control on the
page to scroll to, or you can give it a page element name as a string in
case you want to scroll to something that isn't a .Net control.

There is also a help file that explains/gives examples of use of all
controls available on my website.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

Thanks Justin.

S. Justin Gengo said:
Daniel,

If you'd like some already working code I have a "ScrollToElement" method in
a Javascript component that I give away free on my website (everything there
is free). If you click on the "Code Library" link at the top of
www.aboutfortunate.com and then click the "Javascript" button in the menu on
the left you can download all source code for the component as a Visual
Studio.Net 2003 project. Even if you don't want to use the whole javascript
component (it has a lot of other useful scripts in it) you could always
strip out the ScrollToElement code. It lets you specify what control on the
page to scroll to, or you can give it a page element name as a string in
case you want to scroll to something that isn't a .Net control.

There is also a help file that explains/gives examples of use of all
controls available on my website.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

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,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top