Click here to Skip to main content
16,017,069 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionvalue is not getting in dropdown after a button click Pin
anbusenthil9-Jun-09 21:15
anbusenthil9-Jun-09 21:15 
AnswerRe: value is not getting in dropdown after a button click Pin
jloubani9-Jun-09 21:18
jloubani9-Jun-09 21:18 
GeneralRe: value is not getting in dropdown after a button click Pin
Christian Graus9-Jun-09 21:21
protectorChristian Graus9-Jun-09 21:21 
GeneralRe: value is not getting in dropdown after a button click Pin
jloubani9-Jun-09 21:26
jloubani9-Jun-09 21:26 
GeneralRe: value is not getting in dropdown after a button click Pin
Christian Graus9-Jun-09 21:36
protectorChristian Graus9-Jun-09 21:36 
AnswerRe: value is not getting in dropdown after a button click Pin
Christian Graus9-Jun-09 21:20
protectorChristian Graus9-Jun-09 21:20 
AnswerRe: value is not getting in dropdown after a button click Pin
Abhijit Jana9-Jun-09 21:23
professionalAbhijit Jana9-Jun-09 21:23 
QuestionStatic Varible Sharing Problem Pin
Shivan Nandan9-Jun-09 21:03
Shivan Nandan9-Jun-09 21:03 
Hai Friends

I have declared a variable outside all the function in an aspx.cs page, like

public partial class StaticVar : System.Web.UI.Page
 {

    static int a;

    protected void Page_Load(object sender, EventArgs e)
    {

        Response.Write(a.ToString());
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        a = 50;
        Response.Write("set 50, a= " + a.ToString());
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        a = 60;
        Response.Write("set 60, a= " + a.ToString());
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Response.Write("a= " + a.ToString());
    }
}


The problem is that when more than one user access this page and modifies the variable a, all the users gets the new value for a,
i.e., they loose the value what they had set for a. They get the value that is been set by the last user.

If I remove 'Static' from its declaration, then its value is not available to other functions.

How to solve this problem.
Please help me.

Shivanandan C V

AnswerRe: Static Varible Sharing Problem Pin
Christian Graus9-Jun-09 21:11
protectorChristian Graus9-Jun-09 21:11 
AnswerRe: Static Varible Sharing Problem Pin
saanj9-Jun-09 21:13
saanj9-Jun-09 21:13 
GeneralRe: Static Varible Sharing Problem Pin
Christian Graus9-Jun-09 21:21
protectorChristian Graus9-Jun-09 21:21 
GeneralRe: Static Varible Sharing Problem Pin
Shivan Nandan9-Jun-09 21:25
Shivan Nandan9-Jun-09 21:25 
GeneralRe: Static Varible Sharing Problem Pin
Colin Angus Mackay9-Jun-09 21:31
Colin Angus Mackay9-Jun-09 21:31 
GeneralRe: Static Varible Sharing Problem Pin
saanj9-Jun-09 21:31
saanj9-Jun-09 21:31 
AnswerRe: Static Varible Sharing Problem Pin
Colin Angus Mackay9-Jun-09 21:24
Colin Angus Mackay9-Jun-09 21:24 
GeneralRe: Static Varible Sharing Problem [modified] Pin
Shivan Nandan9-Jun-09 21:38
Shivan Nandan9-Jun-09 21:38 
QuestionHow To Log when user clicks on the cross button through Ajax Pin
shimona 29-Jun-09 20:54
shimona 29-Jun-09 20:54 
AnswerRe: How To Log when user clicks on the cross button through Ajax Pin
saanj9-Jun-09 21:05
saanj9-Jun-09 21:05 
AnswerRe: How To Log when user clicks on the cross button through Ajax Pin
Sujay chakraborty9-Jun-09 21:17
Sujay chakraborty9-Jun-09 21:17 
QuestionManipulating XML file using GridView and XmlDataSource Pin
Sujay chakraborty9-Jun-09 20:33
Sujay chakraborty9-Jun-09 20:33 
AnswerRe: Manipulating XML file using GridView and XmlDataSource Pin
Abhijit Jana9-Jun-09 21:11
professionalAbhijit Jana9-Jun-09 21:11 
GeneralRe: Manipulating XML file using GridView and XmlDataSource Pin
Sujay chakraborty9-Jun-09 21:21
Sujay chakraborty9-Jun-09 21:21 
GeneralRe: Manipulating XML file using GridView and XmlDataSource Pin
chaitanya2313-Jan-10 20:15
chaitanya2313-Jan-10 20:15 
Questionconfiguration error... Pin
RajpootRohan9-Jun-09 20:16
professionalRajpootRohan9-Jun-09 20:16 
AnswerRe: configuration error... Pin
Abhijit Jana9-Jun-09 20:21
professionalAbhijit Jana9-Jun-09 20:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.