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
How many types of sessions are there in asp net?
How can you identify that the page is post back?
Explain the differences between managed and unmanaged code?
Is there any property names “isnavigating”?
Mention few asp.net validators.
What are the contents of cookie?
From which base class all web forms are inherited?
Tell me the code snippet to show how we can return 404 errors from HttpError?
Can I read the hard disk serial # of the client computer using asp.net?
Describe the master page.
Which is faster viewbag or viewdata?
Explain the purpose of storyboard.targetproperty.
Can you clarified A Web service can only be written in .NET or not?
What is form submit?
Dataset is the disconnected environment. suppose if you are binding records to gridview (disconnected environment) and you are making changes to the the grid but before updating the database if any other user modify the data, how will you avoid such problem?