Referencing controls on aspx page from aspx.vb file

  • Thread starter Thread starter DKode
  • Start date Start date
D

DKode

Ok,

I've figured out how to do this, but not sure why this is happening.

I assume it is because i am creating my UI in dreamweaver and then
opening in VS.NET to do the codebehind.

Let's say i paste the following code into the page.aspx file:
<asp:Label id="myLabel" text="some text" visible="true" />

Now, when i try to access it in the codebehind i have to add a member
so i can refer to it:

Public myLabel as Label


I think that if i add it in the VS.NET designer it automatically adds
this code for me? but since i edit it manually it doesn't?

thank you.
 
DKode,

Yes, visual studio adds that line for you.

Also, it only adds it from design view. (e.g. If you add controls in html
view and then switch to the code-behind page without first toggling to
design view first the code won't get added automatically.)

I've never tried it, but if you create your code in dreamweaver, open it in
visual studio.net, switch to html view and then back to design view it may
add the code to the code-behind page automatically...

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Back
Top