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

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top