ASPX , Placeholders and SET FOCUS

Discussion in 'ASP .Net Web Controls' started by tob, Jun 29, 2004.

  1. tob

    tob Guest

    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
    tob, Jun 29, 2004
    #1
    1. Advertising

  2. tob

    Guest

    On 29 Jun 2004 10:52:36 -0700, (tob) wrote:

    >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
    , Jun 29, 2004
    #2
    1. Advertising

  3. 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.

    --
    RobertK
    { Clever? No just smart. }


    >
    > 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
    >
    Robert Koritnik, Jun 30, 2004
    #3
  4. 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...

    --
    RobertK
    { Clever? No just smart. }

    "Robert Koritnik" <> wrote in message
    news:#...
    > 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.
    >
    > --
    > RobertK
    > { Clever? No just smart. }
    >
    >
    > >
    > > 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
    > >

    >
    >
    Robert Koritnik, Jun 30, 2004
    #4
  5. tob

    Guest

    On Wed, 30 Jun 2004 10:41:43 +0200, "Robert Koritnik"
    <> wrote:

    >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
    , Jun 30, 2004
    #5
  6. 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.

    --
    RobertK
    { Clever? No just smart. }

    <> wrote in message
    news:...
    > On Wed, 30 Jun 2004 10:41:43 +0200, "Robert Koritnik"
    > <> wrote:
    >
    > >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
    Robert Koritnik, Jul 1, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bill Belliveau
    Replies:
    0
    Views:
    365
    Bill Belliveau
    Aug 19, 2003
  2. cyndie woodster via DotNetMonster.com

    web user controls and placeholders

    cyndie woodster via DotNetMonster.com, Mar 2, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    339
    Guest
    Mar 2, 2005
  3. Ulrich Herbst

    SQL Injection and DBI placeholders

    Ulrich Herbst, Jun 15, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    126
    Vetle Roeim
    Jun 16, 2004
  4. Replies:
    2
    Views:
    336
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  5. Roger
    Replies:
    3
    Views:
    319
Loading...

Share This Page