| | |
Transferring Variables
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi,
I have a really quick question. I have Sub Page_Load(...), and in that sub, I set a couple of variables. In a form, further down the page, in the <body> tag, I have a button, set so when I click it, it operates another Sub, Btn_Click(...). How can I access the variable I set in Page_Load in Btn_Click without using a URL transfer method?
Thanks
George
I have a really quick question. I have Sub Page_Load(...), and in that sub, I set a couple of variables. In a form, further down the page, in the <body> tag, I have a button, set so when I click it, it operates another Sub, Btn_Click(...). How can I access the variable I set in Page_Load in Btn_Click without using a URL transfer method?
Thanks
George
•
•
Join Date: Oct 2008
Posts: 4
Reputation:
Solved Threads: 0
I don't know what you mean by Class Declaration, but what I have is:
How can I transfer that variable DayNum from the Sub Page_Load to the Sub Btn_Click?
ASP.NET Syntax (Toggle Plain Text)
<html><head><script language="VB" runat="server"> Sub Page_Load(s As Object, e As EventArgs) Dim DayNum As Integer DayNum = 3 End Sub Sub Btn_Click(s As Object, e As EventArgs) Response.Write(DayNum) End Sub </script> </head><body> ... HTML ... </body> </html>
How can I transfer that variable DayNum from the Sub Page_Load to the Sub Btn_Click?
•
•
Join Date: Oct 2008
Posts: 8
Reputation:
Solved Threads: 1
Sub Page_Load(s As Object, e As EventArgs)
Dim DayNum As Integer
DayNum = 3
Session["DayNum"] = DayNum;
End Sub
Sub Btn_Click(s As Object, e As EventArgs)
Response.Write(System.Convert.ToInt32(Session["DayNum"]));
Session["DayNum"] = null;
End Sub
Dim DayNum As Integer
DayNum = 3
Session["DayNum"] = DayNum;
End Sub
Sub Btn_Click(s As Object, e As EventArgs)
Response.Write(System.Convert.ToInt32(Session["DayNum"]));
Session["DayNum"] = null;
End Sub
![]() |
Similar Threads
- Transferring variables across forms in VB6 (Visual Basic 4 / 5 / 6)
- Need help getting value of text boxes into variables (VB.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: error in database connection
- Next Thread: reading a text file to a remote PC
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers






