Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > aspx HTML Server Control Question

Reply
Thread Tools

aspx HTML Server Control Question

 
 
=?Utf-8?B?U3R1YXJ0?=
Guest
Posts: n/a
 
      02-10-2005
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
 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      02-10-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on HTML server control vs HTML control =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?= ASP .Net 5 09-15-2005 07:51 PM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
ASpx to ASPx server control posting =?Utf-8?B?Um9iIFNob3JuZXk=?= ASP .Net 3 09-29-2004 02:46 PM
include other aspx/html in my aspx page Mr. x ASP .Net 1 11-30-2003 11:56 PM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden ASP .Net 1 10-11-2003 07:09 PM



Advertisments