How to read/write standard server control properties from a class file? VB.NET example requested.

Discussion in 'ASP .Net Web Controls' started by John Smith, Apr 1, 2004.

  1. John Smith

    John Smith Guest

    I want to be able to read and write standard server control properties
    from code in a separate class file in vb.net. I learned how to access
    the httpcontext of the calling .aspx page in the class file code, like
    this:

    Dim _Context As HttpContext = HttpContext.Current

    which lets me do things like:

    _Context.response.redirect("otherpage.aspx")

    This is great. Now I need to learn how to read and write standard
    server control properties from the code in a separate class file. For
    example, if I have a label named label1 on the calling aspx page, how
    do I do a label1.text = "hello" from code in the class file?

    I need this to work if I call the code in the class file from any
    number of different aspx files, the names of which I won't know up
    front. Thus, I need the class file code to be able to sense what aspx
    file is calling it, and take the appropriate steps.

    I saw so many posts on this question, but the answers were all too
    complex or too brief for me to understand. I need a complete example,
    and assume I don't know what things like "cast" mean. I know that
    this will be easy once I learn the trick, but I burned up most of
    today trying to solve this.

    In particular, do I need to do anything to the calling aspx page? I
    suspect I need to change the server controls somehow so they are
    publically available, butg I don't know.

    On the class side, do I need to add any imports statements to the top?
    Do I need to add any references? What code do I need to be able to
    access arbitrary calling aspx pages?

    Thanks!
     
    John Smith, Apr 1, 2004
    #1
    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. Brian
    Replies:
    2
    Views:
    2,140
    BMukes
    May 28, 2004
  2. caldwellinva

    CSV Dialect Example Requested - NEWBIE

    caldwellinva, Oct 28, 2003, in forum: Python
    Replies:
    4
    Views:
    3,133
    Skip Montanaro
    Oct 28, 2003
  3. ben beroukhim
    Replies:
    16
    Views:
    2,020
    Steve Summit
    Dec 13, 2004
  4. Replies:
    0
    Views:
    446
  5. kalariyaamit
    Replies:
    0
    Views:
    758
    kalariyaamit
    Nov 26, 2008
Loading...

Share This Page