Referencing controls on aspx page from aspx.vb file

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.
 
S

S. Justin Gengo

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
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top