ASPX , Placeholders and SET FOCUS

T

tob

Hi,

How do SET FOCUS on a newly served (aspx) page to something that was
added into a [PLACEHOLDER] ?

I;ve tried typical Javascript and Page.RegisterStartup, but I get an
error saying that the object (say some "newTextBox1") does not exist !
But it will soon, right?

I've tried adding the script to the Page_Load, and Pre-Render in the
code-behind but with no success..but where else *could* it go??

The Webcontrols.Textbox at "add" time has properties such as "ID", but
not "set focus"

any ideas?

thanks,
tob
 
A

ashelley

Hi,

How do SET FOCUS on a newly served (aspx) page to something that was
added into a [PLACEHOLDER] ?

I;ve tried typical Javascript and Page.RegisterStartup, but I get an
error saying that the object (say some "newTextBox1") does not exist !
But it will soon, right?

I've tried adding the script to the Page_Load, and Pre-Render in the
code-behind but with no success..but where else *could* it go??

The Webcontrols.Textbox at "add" time has properties such as "ID", but
not "set focus"

any ideas?

thanks,
tob

put a label at the very bottom of the form. set its text property to
the javascript you want when u want it. The ensures that the
javascript will run last.

-Adam
 
R

Robert Koritnik

Could you PLEASE translate your suggestion to English language? I didn't get
your answer what exactly should be done... May be a good trick though.
 
R

Robert Koritnik

Forget it. I think I "decoded" your answer...
Shouldn't BODY OnLoad do the trick, because the event won't fire until the
document is fully loaded. Injecting javascript code before that is not a
really smart idea...
 
A

ashelley

Forget it. I think I "decoded" your answer...
Shouldn't BODY OnLoad do the trick, because the event won't fire until the
document is fully loaded. Injecting javascript code before that is not a
really smart idea...

if it works why would it be so bad? i do it in my apps and it works
great. I set the visible tage on the label to false so when i want a
certain block of script to run i just set visible to true and boom.

there are a lot of ways to do most things. choose what is best for
u're app.

-adam
 
R

Robert Koritnik

I ran into a problem with this in some more "loaded" web app. What happened
was the nasty IE general fault that asks you about sending error to
wherever... Since then I avoid this technique. I rather use legal events
that work much more expectedly.
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top