473,473 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

About persistance of WebForm class in ASP.NET

Hi,

I have a question about ASP.NET :

Here is an example of WebForm code. 2 buttons and 1 textbox.
----------------------------------------------------------------------------
-----------------------
Public Class MyWebPage
Inherits System.Web.UI.Page

Protected WithEvents MyButton1 As System.Web.UI.WebControls.Button
Protected WithEvents MyButton2 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox

' Web Form Designer Generated Code

Private m_strMyString As String

Private Sub MyButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyButton1.Click
m_strMyString = "Hello"
End Sub

Private Sub MyButton2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyButton2.Click
TextBox1.Text = m_strMyString
End Sub

End Class
----------------------------------------------------------------------------
-------------------------

When I click MyButton1, I set m_strMyString to "Hello" but after that, if I
click on MyButton2, m_strMyString is Nothing.
Each time I return to server all variables are erased.
Is it normal ?
Is ther a way to correct this without using Session variables or shared
variables ?

Thanks a lot

Guillaume
Nov 17 '05 #1
0 796

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Leo | last post by:
Hi, I'm back to ASP for a short while and I was wondering how I could save the entire Application/Session-state to a file or database and how to read it back afterwards. I'd like to preserve...
0
by: Bita-kookoo | last post by:
I am having a problem with inheritance for my web solution. Here are the steps I took for a project within C#: -I first created a new class, descended from System.Web.UI.Page. For this...
4
by: Free | last post by:
Hi, I have a question about ASP.NET : Here is an example of WebForm code. 2 buttons and 1 textbox. ----------------------------------------------------------------------------...
3
by: Tim Zych | last post by:
If I declare a procedure in a webform as Public and attach it to a button in the same webform, it runs fine. If I change it to Private Sub and try to click it i get the error: ...
2
by: Mark Olbert | last post by:
I'm confused about the behavior of inherited WebForms under VS/NET 2003. In the Windows.Forms world, if I create a UserControl with a protected component on it, that protected component is...
2
by: Craig Douthitt via DotNetMonster.com | last post by:
I am trying to capture an buttonclick on a usercontrol in the webform the usercontrol resides in. After researching this issue, I've come to believe that the best way of handling this is by raising...
3
by: Dean Slindee | last post by:
Would like to call the TabShow function on WebForm InOutHost from another WebForm in same project, but cannot figure out how to get a reference. Can this be done? In this statement: Call...
45
by: bigdadro | last post by:
I've created a new class using prototype.js. After I make the ajax.request all references to this.myClassMethodorVariable are lost. Does the ajax method blow out the object persistance? I'm fairly...
7
by: Max | last post by:
Please somebody can shed a light... How can I have a variable visible and modifiable, inside one and only webform? I mean , I d like to see that variable from all the Sub of that webform code,...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have start web form and when the user clicks a button (server.transfer) they are directed to the second webform. I was wondering if there is a way to create an instance of the first webform...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.