|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Passing values to another web pagevalues from one web page to another like this (VS2005): 1. Declare and create the properties on the first page (source form): Public ReadOnly Property UserName() As String Get Return userNameTextBox.Text End Get End Property 2. Call the next page by calling the Transfer method of the Server object: Private Sub pageTwoButton_Click(...) Server.Transfer("secondWebForm.aspx") End Sub 3. In the Page_Load event of the second page, create an instance of the source page and retrieve the property values from the instance: Public originalPage As WebForm Private userName As String Private Sub Page_Load(...) If Not IsPostBack() Then originalPage = CType(Context.Handler, firstWebForm) userName = originalPage.UserName 'Retrieve the value userLabel.Text = userName 'Preserve for future postbacks End If End Sub Question: How is 'Public originalPage As WebForm' a declaration of an instance of the first page? I can't even find WebForm as a valid type declaration. Many thanx, Rip Ripper,
I never succeeded to pass to another page. Remember that a page is stateless, therefore it does not exist anymore on your server as soon as it is send. Most people use the long time existing Session.Items for that. There is as well another method, but for me the Sessions.Item did it the best. Cor Show quoteHide quote "RipperT" <Ripp***@Nowhere.com> schreef in bericht news:eaF0y35AHHA.3368@TK2MSFTNGP03.phx.gbl... > College newbie here (Instructor MIA). I have instructions to pass variable > values from one web page to another like this (VS2005): > > 1. Declare and create the properties on the first page (source form): > Public ReadOnly Property UserName() As String > Get > Return userNameTextBox.Text > End Get > End Property > 2. Call the next page by calling the Transfer method of the Server object: > Private Sub pageTwoButton_Click(...) > Server.Transfer("secondWebForm.aspx") > End Sub > 3. In the Page_Load event of the second page, create an instance of the > source page and retrieve the property values from the instance: > Public originalPage As WebForm > Private userName As String > Private Sub Page_Load(...) > If Not IsPostBack() Then > originalPage = CType(Context.Handler, firstWebForm) > userName = originalPage.UserName 'Retrieve the value > userLabel.Text = userName 'Preserve for future postbacks > End If > End Sub > > Question: How is 'Public originalPage As WebForm' a declaration of an > instance of the first page? I can't even find WebForm as a valid type > declaration. > > Many thanx, > > Rip > > > > > Thanks for the response. Our instructions mentioned the use of
Session.Items, but did not include details on how to use it. Can you provide an example? Many thanks, Ripper Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23KY$1p7AHHA.3928@TK2MSFTNGP03.phx.gbl... > Ripper, > > I never succeeded to pass to another page. Remember that a page is > stateless, therefore it does not exist anymore on your server as soon as > it is send. > > Most people use the long time existing Session.Items for that. > > There is as well another method, but for me the Sessions.Item did it the > best. > > Cor > > > "RipperT" <Ripp***@Nowhere.com> schreef in bericht > news:eaF0y35AHHA.3368@TK2MSFTNGP03.phx.gbl... >> College newbie here (Instructor MIA). I have instructions to pass >> variable values from one web page to another like this (VS2005): >> >> 1. Declare and create the properties on the first page (source form): >> Public ReadOnly Property UserName() As String >> Get >> Return userNameTextBox.Text >> End Get >> End Property >> 2. Call the next page by calling the Transfer method of the Server >> object: >> Private Sub pageTwoButton_Click(...) >> Server.Transfer("secondWebForm.aspx") >> End Sub >> 3. In the Page_Load event of the second page, create an instance of the >> source page and retrieve the property values from the instance: >> Public originalPage As WebForm >> Private userName As String >> Private Sub Page_Load(...) >> If Not IsPostBack() Then >> originalPage = CType(Context.Handler, firstWebForm) >> userName = originalPage.UserName 'Retrieve the value >> userLabel.Text = userName 'Preserve for future postbacks >> End If >> End Sub >> >> Question: How is 'Public originalPage As WebForm' a declaration of an >> instance of the first page? I can't even find WebForm as a valid type >> declaration. >> >> Many thanx, >> >> Rip >> >> >> >> >> > > Ripper,
Just use it, to transport a dataset it is by instance session.Item("ds") = ds And to use it in your other page ds as dataset = DirectCast(session.Item("ds"),DataSet) Cor Show quoteHide quote "RipperT @comcast.net>" <rippert<nospam> schreef in bericht news:ORrigL%23AHHA.996@TK2MSFTNGP02.phx.gbl... > Thanks for the response. Our instructions mentioned the use of > Session.Items, but did not include details on how to use it. Can you > provide an example? > > Many thanks, > > Ripper > > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message > news:%23KY$1p7AHHA.3928@TK2MSFTNGP03.phx.gbl... >> Ripper, >> >> I never succeeded to pass to another page. Remember that a page is >> stateless, therefore it does not exist anymore on your server as soon as >> it is send. >> >> Most people use the long time existing Session.Items for that. >> >> There is as well another method, but for me the Sessions.Item did it the >> best. >> >> Cor >> >> >> "RipperT" <Ripp***@Nowhere.com> schreef in bericht >> news:eaF0y35AHHA.3368@TK2MSFTNGP03.phx.gbl... >>> College newbie here (Instructor MIA). I have instructions to pass >>> variable values from one web page to another like this (VS2005): >>> >>> 1. Declare and create the properties on the first page (source form): >>> Public ReadOnly Property UserName() As String >>> Get >>> Return userNameTextBox.Text >>> End Get >>> End Property >>> 2. Call the next page by calling the Transfer method of the Server >>> object: >>> Private Sub pageTwoButton_Click(...) >>> Server.Transfer("secondWebForm.aspx") >>> End Sub >>> 3. In the Page_Load event of the second page, create an instance of the >>> source page and retrieve the property values from the instance: >>> Public originalPage As WebForm >>> Private userName As String >>> Private Sub Page_Load(...) >>> If Not IsPostBack() Then >>> originalPage = CType(Context.Handler, firstWebForm) >>> userName = originalPage.UserName 'Retrieve the value >>> userLabel.Text = userName 'Preserve for future postbacks >>> End If >>> End Sub >>> >>> Question: How is 'Public originalPage As WebForm' a declaration of an >>> instance of the first page? I can't even find WebForm as a valid type >>> declaration. >>> >>> Many thanx, >>> >>> Rip >>> >>> >>> >>> >>> >> >> > > Thank you for the help.
Rip Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23kP6jzIBHHA.4740@TK2MSFTNGP03.phx.gbl... > Ripper, > > Just use it, to transport a dataset it is by instance > > session.Item("ds") = ds > > And to use it in your other page > ds as dataset = DirectCast(session.Item("ds"),DataSet) > > Cor > > "RipperT @comcast.net>" <rippert<nospam> schreef in bericht > news:ORrigL%23AHHA.996@TK2MSFTNGP02.phx.gbl... >> Thanks for the response. Our instructions mentioned the use of >> Session.Items, but did not include details on how to use it. Can you >> provide an example? >> >> Many thanks, >> >> Ripper >> >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >> news:%23KY$1p7AHHA.3928@TK2MSFTNGP03.phx.gbl... >>> Ripper, >>> >>> I never succeeded to pass to another page. Remember that a page is >>> stateless, therefore it does not exist anymore on your server as soon as >>> it is send. >>> >>> Most people use the long time existing Session.Items for that. >>> >>> There is as well another method, but for me the Sessions.Item did it the >>> best. >>> >>> Cor >>> >>> >>> "RipperT" <Ripp***@Nowhere.com> schreef in bericht >>> news:eaF0y35AHHA.3368@TK2MSFTNGP03.phx.gbl... >>>> College newbie here (Instructor MIA). I have instructions to pass >>>> variable values from one web page to another like this (VS2005): >>>> >>>> 1. Declare and create the properties on the first page (source form): >>>> Public ReadOnly Property UserName() As String >>>> Get >>>> Return userNameTextBox.Text >>>> End Get >>>> End Property >>>> 2. Call the next page by calling the Transfer method of the Server >>>> object: >>>> Private Sub pageTwoButton_Click(...) >>>> Server.Transfer("secondWebForm.aspx") >>>> End Sub >>>> 3. In the Page_Load event of the second page, create an instance of the >>>> source page and retrieve the property values from the instance: >>>> Public originalPage As WebForm >>>> Private userName As String >>>> Private Sub Page_Load(...) >>>> If Not IsPostBack() Then >>>> originalPage = CType(Context.Handler, firstWebForm) >>>> userName = originalPage.UserName 'Retrieve the value >>>> userLabel.Text = userName 'Preserve for future postbacks >>>> End If >>>> End Sub >>>> >>>> Question: How is 'Public originalPage As WebForm' a declaration of an >>>> instance of the first page? I can't even find WebForm as a valid type >>>> declaration. >>>> >>>> Many thanx, >>>> >>>> Rip >>>> >>>> >>>> >>>> >>>> >>> >>> >> >> > >
Learning OOP conceptual question
What do you call nested If...Then search loops? convert idl to c# or tlb code collapsing in vb.net 2005 File Aging Program Iterating through a Hastable of objects Problem Adding and Using Resource Files Find a control on a form of a specific name Newbie: general requirements to write a program for video coding? Re-size label text |
|||||||||||||||||||||||