I'm quite new in web development. Just want to know how to call my global variable in my aspx page(server side).
In my class page. Here's my code.
In my default.aspx page. Here's my code.
Imports Microsoft.VisualBasic
Namespace GlobalClass
Public Class global_class
Public oGridItem As DataGridItem
Public Web_Class As New WEBClass.ApplicationTool
Function GetGridItem(CtrlName As String, Optional gridItem As DataGridItem = Nothing) As Object
Select Case IsNothing(gridItem)
Case True
Return oGridItem.FindControl(CtrlName)
Case False
Return gridItem.FindControl(CtrlName)
End Select
End Function
End Class
End Namespace
Imports GlobalClass.global_class
Imports _DataBinding.databinding
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
Catch Exp As Exception
Web_Class.SetMessage(Exp)
End Try
End Sub
End Class
I just want to ask, how can I call the Web_Class variable in my default.aspx page?
hikaru1207
Member
1 Points
17 Posts
How to call global variable
Feb 22, 2013 03:28 PM|LINK
Hi experts,
I'm quite new in web development. Just want to know how to call my global variable in my aspx page(server side).
In my class page. Here's my code.
In my default.aspx page. Here's my code.
Imports Microsoft.VisualBasic Namespace GlobalClass Public Class global_class Public oGridItem As DataGridItem Public Web_Class As New WEBClass.ApplicationTool Function GetGridItem(CtrlName As String, Optional gridItem As DataGridItem = Nothing) As Object Select Case IsNothing(gridItem) Case True Return oGridItem.FindControl(CtrlName) Case False Return gridItem.FindControl(CtrlName) End Select End Function End Class End NamespaceImports GlobalClass.global_class Imports _DataBinding.databinding Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Try Catch Exp As Exception Web_Class.SetMessage(Exp) End Try End Sub End ClassI just want to ask, how can I call the Web_Class variable in my default.aspx page?
Hope to hear positive feedback from you.
Thanks,
mebinici
Participant
829 Points
258 Posts
Re: How to call global variable
Feb 22, 2013 05:52 PM|LINK
Well in your example you are declare objects and a function that returns an object.
dim oMyObject as New GlobalClass.global_class
dim oGridItem as Object = oMyObject.GetGridItem(param1, param2)
Something like that. If you are trying to set private member variables, you can do that inside the class as well.
Love collecting video games, movies and board games!
Enjoying my '11 WRX, so sexy...
rameps
Member
292 Points
153 Posts
Re: How to call global variable
Feb 22, 2013 05:59 PM|LINK
I think Its not possible .
But you can use Session or cookies or querystring .