Toggle text

  • Thread starter Thread starter Jon
  • Start date Start date
J

Jon

I'm looking for a way to toggle text without using client scripting.
One way to go is by the visibility property and a click event, but this
does a postback and returns to the top of the page. Is there a way
around this?


Jon Cosby
 
I'm looking for a way to toggle text without using client scripting.
One way to go is by the visibility property and a click event, but this
does a postback and returns to the top of the page. Is there a way
around this?

Not without client scripting. And, unless you are using a form submit, the
click event will be client scripted anyways (to trigger the postback).

One option of the top of my head:

Don't use a postback, but instead querystrings, then add a dynamic redirect
pointing back to the page with an anchor link attached to the URL.

If you don't want to use javascript for the toggle, but are OK using it just
to scroll the page, then you can attach a javascript to the body tag onload
from the postback trigger's handler:

pageBody.Attributes.Add("onLoad", "location.href='#yourAnchor';")

-Darrel
 
no. if you want the server to do it, you need to postback. you could then
use client script to reposition the page, but then why not use client script
in the first place. you could try smart navigation (which is a client script
solution), but its IE only and has some issues.

-- bruce (sqlwork.com)
 
If you do go the postback route and need a script to scroll back to your
original position, and don't want to use smart navigation I wrote a script
(ScrollToElement) that is in a javascript component available for free (with
full source code) on my website, www.aboutfortunate.com, I have tested it
with every browser I could think of (latest version of each only) and it
works everywhere.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
You're saying you don't want to use client side script, and then you're also
basically saying you don't want to use server side script either, by ruling
out the postback option.

I'm afraid changing the visibility of an object requires some code to be
executed, whether its client side code or server side code.
 

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

Back
Top