where is declare global variable in asp.net and what is use
of global variable
Answer Posted / sridhar
For Classes to be generally consumable across your site you should place them in APP_CODE folder.
This simple class will provide global variable
imports Microsoft.VisualBasic
Public Class Sample
Public Shared Text as String ="Global Variable Example"
End Class
Using it in a page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Me.Title = Sample.Text
End Sub
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is query string with example?
Distinguish between Server-side and Client-side code?
Which type of state management is provided by Query String in ASP.NET?
Explain file-based dependency and key-based dependency.
Explain the difference between asp.net mvc and asp.net webforms
What is the difference between asp.net mvc and asp.net webforms? : asp.net mvc
What is razor? : asp.net mvc
What is a postback in asp net?
can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?
What are the event handlers that can be included in the Global.asax file?
What is server side in asp.net?
In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?
To bind columns manually which tags do you need to add within the asp:datagrid ?
What is autopost?
Explain the purpose of storyboard.targetproperty.