![]() |
|
|
|
#1 |
|
Hi
I have one problem with using variables in asp.net with C# application. I declared one variable as public and initialized the value for the variable in one event and when calling the value in another event it returns zero in that event. So plz help me hw to call the value in that event. EXample Code public int MyRowcount; // Variable Initialization public void Button1_Click(object sender, System.EventArgs e) { MyRowcount=5; //assigning Value to the variable } public void Button2_Click(object sender, System.EventArgs e) { Response.Write(MyRowcount); //It returns zero value(I want it should return 5) } advance in thanks Jansi Rajkumar. T } jansi_rk |
|
|
|
|
|
|
#2 |
|
Junior Member
Join Date: Sep 2006
Location: BANGALORE,INDIA
Posts: 6
|
Hi Jansi_rk,
if you delclare your variable with static modifier, then it will be available to all the events with in the scope availabe, as follows public static int MyRowcount; Babu BabuA |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| viewstate MAC failed in asp.net 2.0 while postback the page | azraffarveen | Software | 0 | 05-12-2009 03:24 PM |
| .NET 2.0 Web Apps / .NET 3.5 ASP.NET Apps - Differences/Similariti | london1919 | MCTS | 1 | 12-08-2008 03:16 PM |
| ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method) | msandlana | Software | 0 | 04-25-2008 06:37 AM |
| Variable scope | toller | Hardware | 1 | 04-21-2008 08:28 PM |
| ASP.NET 2.0 application does not run in WIN2k3 | johnfraj | Software | 0 | 04-19-2007 08:27 AM |