472,779 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 1554
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.