473,378 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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.ClassNamePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick

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

m_Page2.m_lIdHrq = CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level"))
m_Page2.m_strFnc = 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_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())

Response.Redirect("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 1814
Since you are redirecting then the easiest way is to send them as parameters
(Querystrings)

response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq &"&m_lNivelHrq="&
m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)

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**************@TK2MSFTNGP10.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.ClassNamePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.ServerClick

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

m_Page2.m_lIdHrq = CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level"))
m_Page2.m_strFnc = 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_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())

Response.Redirect("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.microsoft.com> escreveu na
mensagem news:eH**************@TK2MSFTNGP12.phx.gbl...
Since you are redirecting then the easiest way is to send them as parameters (Querystrings)

response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq &"&m_lNivelHrq="& m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)

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**************@TK2MSFTNGP10.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.ClassNamePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick

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

m_Page2.m_lIdHrq = CLng(ds.Tables("Dados").Rows(0).Item("IdLevel"))
m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level"))
m_Page2.m_strFnc = 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_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())

Response.Redirect("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("VarName",Value)
value = session.item("VarName")

hope it helps

eric
"ruca" <ru***@iol.pt> wrote in message
news:O9**************@tk2msftngp13.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.microsoft.com> escreveu na mensagem news:eH**************@TK2MSFTNGP12.phx.gbl...
Since you are redirecting then the easiest way is to send them as

parameters
(Querystrings)

response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq

&"&m_lNivelHrq="&
m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)

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**************@TK2MSFTNGP10.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.ClassNamePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick

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

m_Page2.m_lIdHrq =

CLng(ds.Tables("Dados").Rows(0).Item("IdLevel")) m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level")) m_Page2.m_strFnc = 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_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())

Response.Redirect("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**************@tk2msftngp13.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.microsoft.com> escreveu na mensagem news:eH**************@TK2MSFTNGP12.phx.gbl...
Since you are redirecting then the easiest way is to send them as

parameters
(Querystrings)

response.redirect("Page2.aspx?m_lIdHrq="& m_Page2.m_lIdHrq

&"&m_lNivelHrq="&
m_Page2.m_lNivelHrq &"&m_strFnc="& m_Page2.m_strFnc)

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**************@TK2MSFTNGP10.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.ClassNamePage2

Dim m_Page2 as New ClassNamePage2

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick

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

m_Page2.m_lIdHrq =

CLng(ds.Tables("Dados").Rows(0).Item("IdLevel")) m_Page2.m_lNivelHrq = CLng(ds.Tables("Dados").Rows(0).Item("Level")) m_Page2.m_strFnc = 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_lIdFnc = CLng(UserName.SelectedItem.Value.ToString())

Response.Redirect("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
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...
2
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...
10
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...
10
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...
3
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...
6
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...
11
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...
12
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.