473,796 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<asp:label> reverting to initial value

Why oh why does my <asp:labelrever t to its initial value, having been
changed programmaticall y, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.

Mark

Aug 1 '06 #1
4 1363
<ma**********@g mail.comwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Why oh why does my <asp:labelrever t to its initial value, having been
changed programmaticall y, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.
How is it being populated initially...?
Aug 1 '06 #2
Did you forget to use IsPostBack to avoid re-initialization?

OR

If the control is dynamically added control, then add the control on
Page PreInit, such that view state will be populated for the control.
Controls view state will be populated on subsequent TrackViewState
call.

Hth,
Ramu

ma**********@gm ail.com wrote:
Why oh why does my <asp:labelrever t to its initial value, having been
changed programmaticall y, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.

Mark
Aug 1 '06 #3
It is being populated on the .aspx page directly, using the Text
attribute of the Label class. I'm not setting its initial value in
code.

Mark

Mark Rae wrote:
<ma**********@g mail.comwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Why oh why does my <asp:labelrever t to its initial value, having been
changed programmaticall y, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.

How is it being populated initially...?
Aug 15 '06 #4
Neither of those applies, since it's initial value is not set it code,
and it is not dynamically added.

Mark

Ramu wrote:
Did you forget to use IsPostBack to avoid re-initialization?

OR

If the control is dynamically added control, then add the control on
Page PreInit, such that view state will be populated for the control.
Controls view state will be populated on subsequent TrackViewState
call.

Hth,
Ramu

ma**********@gm ail.com wrote:
Why oh why does my <asp:labelrever t to its initial value, having been
changed programmaticall y, when I click a button in a user control I
have added dynamically to the page? It's EnableViewState is set to
true.

Mark
Aug 15 '06 #5

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

Similar topics

1
2181
by: RSB | last post by:
Hi Every one, Having tuff time to make this work .. i want to have a button and on my form say Delete button. So once i click on it i want to confirm "Are you sure?" on the Client Side and if client select "Cancel" then i want to ignore the action and if "OK" selected then i want to Execute a Server side Event or Procedure. Now what is happening here is for "Delete1" button (in my code) even if Client Select Cancel it is still...
1
1592
by: John Smith | last post by:
I created a dataTable that returns a value from a stored procedure. How would I bind that results of a query to an <asp:label>? Thank you!
6
2933
by: Andreas Klemt | last post by:
Hello, when I use <asp:label font-size="16px" text="Hello World" runat="server" /> and run FireFox Browser the output of "Hello World" is not in Size 16px. The size will be ignored and I can not find it in the HTML Source Code. Why is it a problem with FireFox and what is the solution how to set sizes in Labels?
5
1427
by: Johnb41 | last post by:
I want an "order number" to be displayed more than once on my page. <script language="vb" runat="server"> ... dim ordernumber as string = "123456" page.databind() ... </script>
3
3456
by: nick | last post by:
Is possible for server side code to access the text of <asp:label> changed by client side javascript code?
4
2219
by: Satya | last post by:
Hi all, The following code is throwing a run time error "The server tag is not well formed. " <ItemTemplate> <asp:HyperLink Runat="server" ID="lnkFile" NavigateUrl="javascript:OpenImage('<%# DataBinder.Eval(Container.DataItem,"FileName") %>');"><%#
2
1463
by: John Smith | last post by:
I have this DataGrid: <asp:datagrid id="dg1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="SM"> <ItemTemplate> <asp:Label id="Label2" runat="server" Text='<%# Container.DataItem("SM") %>'> </asp:Label> </ItemTemplate>
8
4526
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...
3
2578
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.