473,804 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass variables value between diferent pages

Hi,
How can I pass the values of some variables from page1.aspx to page2.aspx?
I try to define some variables in page2 and then when I click a button in
page1 it will fill that variables (in page2) with values. The proble is that
when I call page2 variable values are NULL.

Like this:

-------------------------------BEGIN
CODE-----------------------------------------------

Imports AppName.ClassNa mePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerC lick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.ServerC lick

//This values are in a DataSet and are correct (I debug them)

m_Page2.m_lIdHr q = CLng(ds.Tables( "Dados").Rows(0 ).Item("IdLevel "))
m_Page2.m_lNive lHrq = CLng(ds.Tables( "Dados").Rows(0 ).Item("Level") )
m_Page2.m_strFn c = CStr(ds.Tables( "Dados").Rows(0 ).Item("Name"))

//this value it is given from a dropdownlist (I check it, and it returns
the right value)
m_Page2.m_lIdFn c = CLng(UserName.S electedItem.Val ue.ToString())

Response.Redire ct("Page2.aspx" )

//When opens page2.aspx the values are NULL

End Sub
-------------------------------END
CODE-----------------------------------------------

How can I solve this?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
Nov 18 '05 #1
4 1844
Since you are redirecting then the easiest way is to send them as parameters
(Querystrings)

response.redire ct("Page2.aspx? m_lIdHrq="& m_Page2.m_lIdHr q &"&m_lNivelHrq= "&
m_Page2.m_lNive lHrq &"&m_strFnc= "& m_Page2.m_strFn c)

or you can use Session variables.

regards,
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ru***@iol.pt > wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,
How can I pass the values of some variables from page1.aspx to page2.aspx?
I try to define some variables in page2 and then when I click a button in
page1 it will fill that variables (in page2) with values. The proble is that when I call page2 variable values are NULL.

Like this:

-------------------------------BEGIN
CODE-----------------------------------------------

Imports AppName.ClassNa mePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerC lick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.ServerC lick

//This values are in a DataSet and are correct (I debug them)

m_Page2.m_lIdHr q = CLng(ds.Tables( "Dados").Rows(0 ).Item("IdLevel "))
m_Page2.m_lNive lHrq = CLng(ds.Tables( "Dados").Rows(0 ).Item("Level") )
m_Page2.m_strFn c = CStr(ds.Tables( "Dados").Rows(0 ).Item("Name"))

//this value it is given from a dropdownlist (I check it, and it returns the right value)
m_Page2.m_lIdFn c = CLng(UserName.S electedItem.Val ue.ToString())

Response.Redire ct("Page2.aspx" )

//When opens page2.aspx the values are NULL

End Sub
-------------------------------END
CODE-----------------------------------------------

How can I solve this?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 18 '05 #2
I like it more of your second option. Can you give me an example of that. I
presume that I have to set this variables in my GlobaAsa file, right?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Sarmad Aljazrawi" <anonymous[shylme]@discussions.mi crosoft.com> escreveu na
mensagem news:eH******** ******@TK2MSFTN GP12.phx.gbl...
Since you are redirecting then the easiest way is to send them as parameters (Querystrings)

response.redire ct("Page2.aspx? m_lIdHrq="& m_Page2.m_lIdHr q &"&m_lNivelHrq= "& m_Page2.m_lNive lHrq &"&m_strFnc= "& m_Page2.m_strFn c)

or you can use Session variables.

regards,
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ru***@iol.pt > wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,
How can I pass the values of some variables from page1.aspx to page2.aspx? I try to define some variables in page2 and then when I click a button in page1 it will fill that variables (in page2) with values. The proble is

that
when I call page2 variable values are NULL.

Like this:

-------------------------------BEGIN
CODE-----------------------------------------------

Imports AppName.ClassNa mePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerC lick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.ServerC lick

//This values are in a DataSet and are correct (I debug them)

m_Page2.m_lIdHr q = CLng(ds.Tables( "Dados").Rows(0 ).Item("IdLevel "))
m_Page2.m_lNive lHrq = CLng(ds.Tables( "Dados").Rows(0 ).Item("Level") )
m_Page2.m_strFn c = CStr(ds.Tables( "Dados").Rows(0 ).Item("Name"))

//this value it is given from a dropdownlist (I check it, and it

returns
the right value)
m_Page2.m_lIdFn c = CLng(UserName.S electedItem.Val ue.ToString())

Response.Redire ct("Page2.aspx" )

//When opens page2.aspx the values are NULL

End Sub
-------------------------------END
CODE-----------------------------------------------

How can I solve this?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca


Nov 18 '05 #3
unless you want to store the variables on an sql server or work cookieless
you don't have to do anithing special

session.add("Va rName",Value)
value = session.item("V arName")

hope it helps

eric
"ruca" <ru***@iol.pt > wrote in message
news:O9******** ******@tk2msftn gp13.phx.gbl...
I like it more of your second option. Can you give me an example of that. I presume that I have to set this variables in my GlobaAsa file, right?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Sarmad Aljazrawi" <anonymous[shylme]@discussions.mi crosoft.com> escreveu na mensagem news:eH******** ******@TK2MSFTN GP12.phx.gbl...
Since you are redirecting then the easiest way is to send them as

parameters
(Querystrings)

response.redire ct("Page2.aspx? m_lIdHrq="& m_Page2.m_lIdHr q

&"&m_lNivelHrq= "&
m_Page2.m_lNive lHrq &"&m_strFnc= "& m_Page2.m_strFn c)

or you can use Session variables.

regards,
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ru***@iol.pt > wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,
How can I pass the values of some variables from page1.aspx to page2.aspx? I try to define some variables in page2 and then when I click a button in page1 it will fill that variables (in page2) with values. The proble is
that
when I call page2 variable values are NULL.

Like this:

-------------------------------BEGIN
CODE-----------------------------------------------

Imports AppName.ClassNa mePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerC lick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.ServerC lick

//This values are in a DataSet and are correct (I debug them)

m_Page2.m_lIdHr q =

CLng(ds.Tables( "Dados").Rows(0 ).Item("IdLevel ")) m_Page2.m_lNive lHrq = CLng(ds.Tables( "Dados").Rows(0 ).Item("Level") ) m_Page2.m_strFn c = CStr(ds.Tables( "Dados").Rows(0 ).Item("Name"))

//this value it is given from a dropdownlist (I check it, and it

returns
the right value)
m_Page2.m_lIdFn c = CLng(UserName.S electedItem.Val ue.ToString())

Response.Redire ct("Page2.aspx" )

//When opens page2.aspx the values are NULL

End Sub
-------------------------------END
CODE-----------------------------------------------

How can I solve this?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca



Nov 18 '05 #4
No you don't need to set it up in global.asa you can set it any place in the
application.

session("myvar" ) = value
value = session("myvar" )

--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ru***@iol.pt > wrote in message
news:O9******** ******@tk2msftn gp13.phx.gbl...
I like it more of your second option. Can you give me an example of that. I presume that I have to set this variables in my GlobaAsa file, right?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

"Sarmad Aljazrawi" <anonymous[shylme]@discussions.mi crosoft.com> escreveu na mensagem news:eH******** ******@TK2MSFTN GP12.phx.gbl...
Since you are redirecting then the easiest way is to send them as

parameters
(Querystrings)

response.redire ct("Page2.aspx? m_lIdHrq="& m_Page2.m_lIdHr q

&"&m_lNivelHrq= "&
m_Page2.m_lNive lHrq &"&m_strFnc= "& m_Page2.m_strFn c)

or you can use Session variables.

regards,
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net
"ruca" <ru***@iol.pt > wrote in message
news:OX******** ******@TK2MSFTN GP10.phx.gbl...
Hi,
How can I pass the values of some variables from page1.aspx to page2.aspx? I try to define some variables in page2 and then when I click a button in page1 it will fill that variables (in page2) with values. The proble is
that
when I call page2 variable values are NULL.

Like this:

-------------------------------BEGIN
CODE-----------------------------------------------

Imports AppName.ClassNa mePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerC lick(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.ServerC lick

//This values are in a DataSet and are correct (I debug them)

m_Page2.m_lIdHr q =

CLng(ds.Tables( "Dados").Rows(0 ).Item("IdLevel ")) m_Page2.m_lNive lHrq = CLng(ds.Tables( "Dados").Rows(0 ).Item("Level") ) m_Page2.m_strFn c = CStr(ds.Tables( "Dados").Rows(0 ).Item("Name"))

//this value it is given from a dropdownlist (I check it, and it

returns
the right value)
m_Page2.m_lIdFn c = CLng(UserName.S electedItem.Val ue.ToString())

Response.Redire ct("Page2.aspx" )

//When opens page2.aspx the values are NULL

End Sub
-------------------------------END
CODE-----------------------------------------------

How can I solve this?
--

Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4255
by: Eddy Ilg | last post by:
Hi, I am having a problem with an application I am writing: I have 2 scripts called 'conf' and 'build'. Both define a variable named 'root' and import a module named 'helper'. In the helper module I want to access the root variable, that is _either_ in conf _or_ build. How can I do this?
2
12370
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the users need not enter values in all the controls. they can leave the textbox blank, and select values from one drop down, or any other combinations. I am trying to pass values with the help of session variables. But I have multiple if else...
10
7247
by: EOZyo | last post by:
Hi, i'm trying to set pagination for a search i run on my website, i'll try to explain the easiest i can: When i click the search button on search.php, data is received and stored in variables within results.php, MySQL structure seems to work as expected, although i get some problems: As soon as i click on the "Page 2" Link, i get nothing, neither results nor page numbers.
10
1569
by: tshad | last post by:
I want to access multiple arguments based on name passed. For example I have the following asp:textboxes: BillingAddress1 BillingAddress2 BillingCity ShippingAddress1 ShippingAddress2 ShippingCity
3
3233
by: valerehorath via AccessMonster.com | last post by:
Hi, I am attempting to select a value in a combo box in a form in access 2000 and pass it to a variable in an html document. How can i do this? Thank you very much. -- Message posted via http://www.accessmonster.com
6
2715
by: lisp9000 | last post by:
I've read that C allows two ways to pass information between functions: o Pass by Value o Pass by Reference I was talking to some C programmers and they told me there is no such thing as pass by reference in C since you are just passing an address (or a pointer value address I guess?). So I was wondering is this correct?
11
8647
by: manjunath1985 | last post by:
Hi, I am really having problem in checkbox.... i have a php page which displays the username retrieved from the database i want to create a checkbox for each username and pass the selected multiple checkbox value to another page after selecting any one of the option value from the select box and after clicking on "go" button. In option value i have links to go for particular page. Plz help me out........ Its very urgent......
12
11118
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.