aspx HTML Server Control Question

Discussion in 'ASP .Net' started by =?Utf-8?B?U3R1YXJ0?=, Feb 10, 2005.

  1. Hi there

    I am trying to introduce some dynamic control focus in to my asp application
    by turning the <body> of the aspx file in to an HTML Server control.

    I have read elsewhere that if you assign an ID to the <body> as well as
    runat="server" : e.g.

    <body id="PageBody" runat="server">

    you should then be able to use:

    PageBody.Attributes("onload") = "document.forms[0] ['TextBox'].focus();"

    for example to shift focus on to certain controls when you want...

    All good

    My problem is that when you assign an ID and runat="server" to the <body> it
    is not automatically declared in the aspx.vb file as you would normally get
    if you simply drag an asp control on to the designer page. Obviously I am
    guilty of relying on the automation normally - but how do I declare PageBody
    in the aspx.vb... what do I declare it as ???

    Your help is much appreciated
    =?Utf-8?B?U3R1YXJ0?=, Feb 10, 2005
    #1
    1. Advertising

  2. Here's a little trick for you: You don't need to use the body onload
    attribute to have a script run when the page loads. Just put the script into
    the body of the page, not as a function, but as script. It will run when the
    page loads. That is exactly what Page.RegisterStartupScript() does.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Neither a follower nor a lender be.

    "Stuart" <> wrote in message
    news:...
    > Hi there
    >
    > I am trying to introduce some dynamic control focus in to my asp
    > application
    > by turning the <body> of the aspx file in to an HTML Server control.
    >
    > I have read elsewhere that if you assign an ID to the <body> as well as
    > runat="server" : e.g.
    >
    > <body id="PageBody" runat="server">
    >
    > you should then be able to use:
    >
    > PageBody.Attributes("onload") = "document.forms[0] ['TextBox'].focus();"
    >
    > for example to shift focus on to certain controls when you want...
    >
    > All good
    >
    > My problem is that when you assign an ID and runat="server" to the <body>
    > it
    > is not automatically declared in the aspx.vb file as you would normally
    > get
    > if you simply drag an asp control on to the designer page. Obviously I am
    > guilty of relying on the automation normally - but how do I declare
    > PageBody
    > in the aspx.vb... what do I declare it as ???
    >
    > Your help is much appreciated
    Kevin Spencer, Feb 10, 2005
    #2
    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. Matthew Louden
    Replies:
    1
    Views:
    6,912
    Scott M.
    Oct 11, 2003
  2. Mr. x
    Replies:
    1
    Views:
    1,965
    John Timney \(Microsoft MVP\)
    Nov 30, 2003
  3. =?Utf-8?B?Um9iIFNob3JuZXk=?=

    ASpx to ASPx server control posting

    =?Utf-8?B?Um9iIFNob3JuZXk=?=, Sep 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    427
    Shiva
    Sep 29, 2004
  4. John M
    Replies:
    1
    Views:
    1,134
    Kumar Reddi
    May 29, 2005
  5. =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=

    Help on HTML server control vs HTML control

    =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=, Sep 15, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    2,140
    =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=
    Sep 15, 2005
Loading...

Share This Page