| | |
Transferring Variables
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
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 2.0 3.5 activexcontrol ajax alltypeofvideos appliances asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# cac checkbox class commonfunctions compatible content contenttype countryselector courier dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal formview gridview gudi iis javascript listbox menu microsoft mono mouse mssql nameisnotdeclared news novell opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers






