473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

aspx HTML Server Control Question

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
Nov 19 '05 #1
1 1210
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" <St****@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Colin | last post by:
Hi there, I really need your help on this. I'm trying to learn to using the VS.2003 to create a User Control. In my aspx code has no problem to use the property "grossWaye" that has "register" in...
3
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
14
by: Mark B | last post by:
Our webhost (www.usbusinessweb.net) had a W2K IIS5 server crash after a scheduled hard-boot occurred during a ms-security patch install overnight. They couldn't get the server working again so they...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
2
by: mharness | last post by:
Hello, I've tried a number of examples showing how to read the properties of a user control from an aspx file where the code is on the html view of the form but I can't figure out how to read...
5
by: c676228 | last post by:
Hi, I guess I am confused. In aspx script, I mean (you won't use Codebehind="enrollinfo.aspx.vb", but mix code with html and code together) You can access user control's property directly. Since I...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.