html id not working in code behind

T

tshad

I am using VS 2008 and have an "id" on my "body" tag but I can't seem to
access it from my code behind. Do I need an Imports of some kind to access
or something else?

In my .aspx page I have:

<body id="myBody">

and in my .aspx.vb I have:

myBody.Attributes.Add("onLoad",
"document.forms[0].SearchName.focus()")

With my imports:

Option Strict On
Imports System.Data
Imports System.Data.SqlClient
Imports MyFunctions.BitHandling
Imports System.Drawing
Imports MyFunctions
Imports RolesBasedAuthentication

Am I missing something?

Thanks,

Tom
 
T

tshad

Mark Rae said:
Something else...


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

Of course.

Little mind fade there.

I always added this to my body tag in the past and just forgot to add it
when I put the id in.

Thanks,

Tom
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top