473,503 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Label losing value on postback (i think) HELP!

Hi

I have a asp.net site in VB.NET and VWD 2005 Express.

in the master page i have a Label.

from a content page i change the value of this label like so:

dim X as label = page.master.findcontrol("Label3")
X.text = "Some Text Here"

this is done on the click event of an image button.

This works fine, the problem is when i navigate to any other page on my
site the label text defaults back to nothing.

im using iumage buttons and response.redirect, could this be the
problem?

Please help im going insane

Andrew

Oct 30 '06 #1
2 6155
Andrew,

When you leave your page, it's gone. It is not a postback. Postback occurs
when the page posts to itself. But even in a postback the page is built from
scratch. Master forms just participate in this building process, they don't
exists between the posts either. For a value to persist, you have to make it
persistent somewhere and restore it in page load event.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"TheAmes" <an*********@apollo-medical.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi

I have a asp.net site in VB.NET and VWD 2005 Express.

in the master page i have a Label.

from a content page i change the value of this label like so:

dim X as label = page.master.findcontrol("Label3")
X.text = "Some Text Here"

this is done on the click event of an image button.

This works fine, the problem is when i navigate to any other page on my
site the label text defaults back to nothing.

im using iumage buttons and response.redirect, could this be the
problem?

Please help im going insane

Andrew

Oct 30 '06 #2
i originally tried using session variables, but i want it so everytime
ia user clicks a certain button on a content page it increments the
session variable by 1.

the problem is the first time they press it , it does not increment.
BUT after the first time it will increment? any ideas? need more info?
Eliyahu Goldin wrote:
Andrew,

When you leave your page, it's gone. It is not a postback. Postback occurs
when the page posts to itself. But even in a postback the page is built from
scratch. Master forms just participate in this building process, they don't
exists between the posts either. For a value to persist, you have to make it
persistent somewhere and restore it in page load event.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"TheAmes" <an*********@apollo-medical.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi

I have a asp.net site in VB.NET and VWD 2005 Express.

in the master page i have a Label.

from a content page i change the value of this label like so:

dim X as label = page.master.findcontrol("Label3")
X.text = "Some Text Here"

this is done on the click event of an image button.

This works fine, the problem is when i navigate to any other page on my
site the label text defaults back to nothing.

im using iumage buttons and response.redirect, could this be the
problem?

Please help im going insane

Andrew
Oct 30 '06 #3

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

Similar topics

10
2583
by: SusanC | last post by:
Hi folks. I have something here that I don't understand. I am passing a value held in a session variable on a url. It works fine locally testing but when I put it on the main web server the...
2
1274
by: gce | last post by:
Hi, My project uses some aspx that jump to eachother. Session variables are used to exchange data. But my session variables are not there until a postback. So when I put a button on the second...
0
1374
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
6
1863
by: Sukh | last post by:
Hi, I am using ASP.Net with C#. My application is using a control and when control object is created my application set all the values to that control. This also contain connection string...
4
2007
by: stevewy | last post by:
If I am using srcElement (or "target" for non-IE models) to return various properties of an object I have clicked on, can I access for "label for" value in any way? I'm thinking, for example, of...
4
24434
by: pradeep | last post by:
how to set input type label's value through javascript
8
4480
by: gelligokul | last post by:
Hello frens i want to retrieve <asp:label> value from the code behind in c# can any one help me...
20
12690
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
0
7193
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
7316
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
6975
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
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
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,...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1495
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 ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
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.