Referencing controls on aspx page from aspx.vb file

Discussion in 'ASP .Net' started by DKode, Nov 12, 2003.

  1. DKode

    DKode Guest

    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, Nov 12, 2003
    #1
    1. Advertising

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


    "DKode" <> wrote in message
    news:...
    > 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. Justin Gengo, Nov 12, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Corey

    Referencing controls on user controls

    Jim Corey, Jan 26, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    360
    Hermit Dave
    Jan 26, 2004
  2. 2obvious
    Replies:
    0
    Views:
    326
    2obvious
    Sep 13, 2004
  3. 2obvious
    Replies:
    2
    Views:
    379
    2obvious
    Jan 11, 2005
  4. DC Gringo

    referencing controls in controls

    DC Gringo, Sep 15, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    136
    DC Gringo
    Sep 16, 2004
  5. DC Gringo

    referencing controls in controls

    DC Gringo, Sep 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    136
    DC Gringo
    Sep 16, 2004
Loading...

Share This Page