Anyone here use VS.NET?

DreamThrall

Newbie
Joined
Oct 14, 2003
Messages
3,483
Reaction score
0
I've got a dumb question about using codebehinds on an ASP.NET page... someone please say you use it.
 
Perhaps... I can't understand what I'm missing here...

I'm using a codebehind (the way VS.NET sets it up for you) on an ASP.NET page, and I'm trying to access server-side objects declared in the HTML code on my codebehind page.

However, I can't figure out how to do it! I would think that if I did this in the HTML code:

Code:
<body id="TheBody" runat="server" />

Then I should be able to access it programatically like this:

Code:
TheBody.Controls.Add(MyStuff)

I even tried just using a placeholder (<asp:placeholder />) and got the same result - VS tells me that the name hasn't been declared and it won't build it.

What am I missing here?
 
shouldn't that be

"id.Controls.Add(YourStuff)"

just a guess.
 
No.... but I figured it out anyways... I was missing this bitty line of code:

Code:
Protected WithEvents MyStuff As WebControls.PlaceHolder
 
Back
Top