Results 1 to 6 of 6

Thread: Server.Transfer from a user control

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question Server.Transfer from a user control

    I need to use the Server.Transfer and my code is working fine when I use Server.Transfer from one webform to another. But if I use Server.Transer from a user control to a webform nothing happens, has anyone got an idea of whats going on?

    I have remembered the EnableViewStateMac="False"

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    You shouldn't have to server.transfer a usercontrol, because the usercontrol is a control within that page. You would simply need code like this in your Load or Prerender (depends on when u need to access or change data), where Me refers to the containing page:
    VB Code:
    1. Dim X As MyUserControl = Me.FindControl('IDofYourUserControl')

    Then you could just type X.whatever to access whatever property or method you need.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    Hmm, not sure I understand. Does that mean that I can get the value of the textbox1 just by writing:

    response.write(Pressure1Abs.textbox1.text)

    ?

    My usercontrol is named Pressure1Abs, if I implement the code you wrote I get an error:

    Dim X As Pressure1Abs = Me.FindControl(Pressure1Abs)

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    what was the error exactly, a conversion error or control not found?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    Sorry, no error, but how can I get the textboxes from the user control? As I can see I can only inherit the methods and functions.
    If I type X. then the textboxes are not visible and if I type
    Code:
    response.write(x.textbox1.text)
    an error occurs.

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Well, you could expose its text as public property...

    you could use FindControl on your usercontrol to find the textbox...

    etc...etc..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width