html id not working in code behind

  • Thread starter Thread starter tshad
  • Start date Start date
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
 
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
 
Back
Top