| | |
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 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol expose findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols problem ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice wizard xml youareanotmemberofthedebuggerusers






