Praveen Kumar

Praveen Kumar

  • NA
  • 33
  • 5.1k

How to declare a Globar Variable in C#?

Jul 14 2017 2:45 AM
Currently I am declaring Global variable as 
public static string SerialNo;
 
I am set value into Declared SerialNo in Page_Load event.
I am using this serial no in multiple methods.
But my problem is  
Suppose there is multiple persons accessing the same page at  the same time In my application mutiple tabs available like Employee Details, Salary Details, ....
A user has two records in Employee Details tab.
B user updated data in Employee Details tab.
 
Both are using different serial no's but accessing same page. 
 
Now A user refresh Employee Details tab he got 3 records(3rd record updated by B user).
 
I am thinking the problem is not declaring SerialNo variable properly. 
 
Please help me how to declare that SerialNo variable Globally.

Answers (2)