473,394 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Another way to put labels on page than asp:label

Is there another way to put labels on a page other than asp:label?

I have been building a page where I use a label to display the calculated
result of some imput. I do it using Javascript. But since the asp:label
equates to a <span> I have to create nodes to display the new text. The
problem is that as soon as I change pages (whether by post or just using a
back button), I lose whatever changes I made.

I don't have that problem with a Textbox.

The reason I am using Javascript is I don't want to make round trips to the
server, just to format the text and display on the page (something easily
done in Javascript).

Thanks,

Tom
Nov 19 '05 #1
2 1584
create a hidden field (name it to match label). the javascript can update
both, on page load (client side), have it fetch the label from the hidden
field.

-- bruce (sqlwork.com)

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is there another way to put labels on a page other than asp:label?

I have been building a page where I use a label to display the calculated
result of some imput. I do it using Javascript. But since the asp:label
equates to a <span> I have to create nodes to display the new text. The
problem is that as soon as I change pages (whether by post or just using a
back button), I lose whatever changes I made.

I don't have that problem with a Textbox.

The reason I am using Javascript is I don't want to make round trips to
the server, just to format the text and display on the page (something
easily done in Javascript).

Thanks,

Tom

Nov 19 '05 #2
"Bruce Barker" <br******************@safeco.com> wrote in message
news:ui**************@TK2MSFTNGP10.phx.gbl...
create a hidden field (name it to match label). the javascript can update
both, on page load (client side), have it fetch the label from the hidden
field.
That might work.

Just to make sure I understand what you are suggesting.

I have an asp:textbox. I have an asp:label. I have an hidden field (input
type=hidden...) - do I need to have this runat=server and does it need to be
a form field?

Are you saying to name the asp:label and hidden field with the same ID? I
thought you couldn't do that?

In my javascript, I have an onChange event on my textbox (actually set from
asp.net). When the user puts a value in the box, I go to my javascript and
format the data and set the asp:label (which is now a SPAN). This is what I
do now which works. In the same function I would also set the hidden field
to the same as the SPAN. For example I have the textbox set to 100, and the
SPAN and Hidden field are set to $100.00.

Now you are saying that I should set up an onLoad event in the Body Tag to
go move the $100.00 back to the SPAN from the hidden field?

Seems like it would work.

Does the onLoad event get called when the user hits his back button and then
the forward button so that the page is redisplayed?

Thanks,

Tom
-- bruce (sqlwork.com)

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is there another way to put labels on a page other than asp:label?

I have been building a page where I use a label to display the calculated
result of some imput. I do it using Javascript. But since the asp:label
equates to a <span> I have to create nodes to display the new text. The
problem is that as soon as I change pages (whether by post or just using
a back button), I lose whatever changes I made.

I don't have that problem with a Textbox.

The reason I am using Javascript is I don't want to make round trips to
the server, just to format the text and display on the page (something
easily done in Javascript).

Thanks,

Tom


Nov 19 '05 #3

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

Similar topics

10
by: Dwizz | last post by:
Hello, I really hope that someone can help me resolve my problem, I've been working on it for the past few days, to no avail. I have an asp:label which gets its value from the database, but what...
5
by: Anton ml. Vahčič | last post by:
Hi, Can anyone tells me how can I set value of asp:Label field with JavaScript? Anton, ml. ---
1
by: moondaddy | last post by:
I want to use a asp Label control (or a <div runat=server> element) in a template column of a datagrid. In the code behind in the grid's ItemDataBound event I need to dynamically set the innerHTML...
3
by: Harry | last post by:
Hi, Can anyone tell me why the below code does not work. I dont get any errors, but nor does the Text for the asp:label get set. Thanks in advance as always H
4
by: Jeronimo Bertran | last post by:
I am currently using databing to show on an asp:label the result of appending two database fields in the following way: <asp:label id=textAcknowledgedBy runat="server" Text='<%# DataBinder.Eval...
0
by: Shapper | last post by:
Hello, I have an Asp:Label inside the HeaderTemplate of an ASP:Repeater: <asp:Repeater id="myRepeater" runat="server"> <HeaderTemplate> <asp:Label id="title" runat="server"></asp:Label> ... ...
1
by: Jimmy | last post by:
Hi In my headertemplate I do not get the column like in the itemtemplate ( I am using the northwind db): <asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute;...
1
by: maflatoun | last post by:
Hi, I have a datagrid and based on a condition I like to display either a asp:textbox or asp:label. How would I do that? I have the following <asp:TemplateColumn HeaderText="Qty">...
1
by: Steve Hershoff | last post by:
I'm using VS 2003, and need to extract the text from an asp label in my code-behind file. The label is part of a DataList's ItemTemplate. I've noticed that in my ascx file (we're using User...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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
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...

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.