Ask a Question related to ASP.NET General, Design and Development.
-
Tor Inge Rislaa #1
How to refer to a variable on another webform
How to refer to a variable on another webform
Hi, I have a Webform1 with a public variable that is assigned a value before
my Webform2 is displayed. In the Page_Load procedure of Webform2 I want to
evaluate the value of the variable of Webform1.
Code on Webform1
Public MyVar1 As Integer
Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick
MyVar1 = 1
Server.Transfer("Webform2.aspx")
End Sub
Code on Webform2
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Myvar2 As Integer
Myvar2 = (Myvar1 from Webform1... Any Ideas?)
End Sub
T I Rislaa
Tor Inge Rislaa Guest
-
How to refer Datagrid element
:smile; I am using flex 2.0. How to refer a datagrid element directly in script dynamically without using the item edit event? For example I would... -
Refer to a button in a form by ID rather than name
Hi, I would like to know if there is a way to call or refer to the radio button with it's id tag not the name because when I have the two... -
How to refer Page level variable from a control?
Hi, I have a composite control inherited from System.Web.UI.Control. Inside of this control I need to refer to a Page level variable ... -
Blocking a refer
Hi, Is there a way that I could block a certain refer from my website using PHP? Thanks, Wayne. -
Including WebForm Image Control in a Webform Table Control
What is the code for including an image control in a Table control of a WebForm ???? regards -
Marina #2
Re: How to refer to a variable on another webform
You can't. Once the webform1 finishes execution, it ceases to exist.
You will have to store the value in session or pass it in the query string,
or place it elsewhere where both forms can access to it.
"Tor Inge Rislaa" <tor.inge.nospam@rislaa.no> wrote in message
news:e5f32B1WDHA.2328@TK2MSFTNGP12.phx.gbl...before> How to refer to a variable on another webform
>
> Hi, I have a Webform1 with a public variable that is assigned a value> my Webform2 is displayed. In the Page_Load procedure of Webform2 I want to
> evaluate the value of the variable of Webform1.
>
> Code on Webform1
>
> Public MyVar1 As Integer
>
> Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.ServerClick
>
> MyVar1 = 1
> Server.Transfer("Webform2.aspx")
>
> End Sub
>
>
> Code on Webform2
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Dim Myvar2 As Integer
> Myvar2 = (Myvar1 from Webform1... Any Ideas?)
>
> End Sub
>
> T I Rislaa
>
>
>
Marina Guest
-
Tap #3
How to refer to a variable on another webform
Open the Visual Studio.NET help....and type in the
following in the address bar.....
ms-
help://MS.VSCC/MS.MSDNVS/vbcon/html/vbtskPassingValuesBetwe
enWebFormsPages.htm
It describes how to pass values in between web forms and
of course you can always use query strings too.
Thanks,
Tap
assigned a value before>-----Original Message-----
>How to refer to a variable on another webform
>
>Hi, I have a Webform1 with a public variable that isWebform2 I want to>my Webform2 is displayed. In the Page_Load procedure ofSystem.Object, ByVal e As>evaluate the value of the variable of Webform1.
>
>Code on Webform1
>
>Public MyVar1 As Integer
>
>Private Sub Button1_ServerClick(ByVal sender AsByVal e As>System.EventArgs) Handles Button1.ServerClick
>
> MyVar1 = 1
> Server.Transfer("Webform2.aspx")
>
>End Sub
>
>
>Code on Webform2
>
>Private Sub Page_Load(ByVal sender As System.Object,>System.EventArgs) Handles MyBase.Load
>
> Dim Myvar2 As Integer
> Myvar2 = (Myvar1 from Webform1... Any Ideas?)
>
>End Sub
>
>T I Rislaa
>
>
>
>.
>Tap Guest
-
S. Justin Gengo #4
Re: How to refer to a variable on another webform
That's not correct.
You can use server.transfer as your code is beginning to. The next step is
to recreate the first page on the second. You will need to do a CType on the
context object that is passed using server.transfer.
Dim Page1 As Page1 = CType(Context, Page1)
The important thing is that if you can arrive at a page2 from more pages
than page1 this code will error out if you try to make say, page3, into
page1.
I have some sample code in the code library on my website,
[url]www.aboutfortunate.com[/url] for determining which page a context object came
from. Just search for: "get page name".
I hope this helps.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"Marina" <zlatkinam@nospam.hotmail.com> wrote in message
news:eeivzL1WDHA.1512@TK2MSFTNGP11.phx.gbl...string,> You can't. Once the webform1 finishes execution, it ceases to exist.
>
> You will have to store the value in session or pass it in the queryto> or place it elsewhere where both forms can access to it.
>
> "Tor Inge Rislaa" <tor.inge.nospam@rislaa.no> wrote in message
> news:e5f32B1WDHA.2328@TK2MSFTNGP12.phx.gbl...> before> > How to refer to a variable on another webform
> >
> > Hi, I have a Webform1 with a public variable that is assigned a value> > my Webform2 is displayed. In the Page_Load procedure of Webform2 I wantAs> > evaluate the value of the variable of Webform1.
> >
> > Code on Webform1
> >
> > Public MyVar1 As Integer
> >
> > Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e>> > System.EventArgs) Handles Button1.ServerClick
> >
> > MyVar1 = 1
> > Server.Transfer("Webform2.aspx")
> >
> > End Sub
> >
> >
> > Code on Webform2
> >
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> >
> > Dim Myvar2 As Integer
> > Myvar2 = (Myvar1 from Webform1... Any Ideas?)
> >
> > End Sub
> >
> > T I Rislaa
> >
> >
> >
>
S. Justin Gengo Guest



Reply With Quote

