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

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

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

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. 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:
    413
    Guest
    Mar 2, 2005
  2. John M
    Replies:
    1
    Views:
    1,597
    Kumar Reddi
    May 29, 2005
  3. Manav
    Replies:
    0
    Views:
    942
    Manav
    Oct 15, 2003
  4. Ulrich Herbst

    SQL Injection and DBI placeholders

    Ulrich Herbst, Jun 15, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    199
    Vetle Roeim
    Jun 16, 2004
  5. Richard Gration
    Replies:
    1
    Views:
    275
    Richard Gration
    Jul 7, 2005
  6. Richard Gration
    Replies:
    5
    Views:
    483
    Richard Gration
    Jul 7, 2005
  7. Replies:
    2
    Views:
    521
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  8. Roger
    Replies:
    3
    Views:
    596
Loading...