Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Another way to put labels on page than asp:label

Reply
Thread Tools

Another way to put labels on page than asp:label

 
 
tshad
Guest
Posts: n/a
 
      04-07-2005
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


 
Reply With Quote
 
 
 
 
Bruce Barker
Guest
Posts: n/a
 
      04-07-2005
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      04-08-2005
"Bruce Barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lets put it another way Paul C++ 76 05-26-2011 11:56 AM
"pointlabel"-like function for Python: distribute text labels on a2-d scatter plot to avoid overlapping labels C Barrington-Leigh Python 1 09-12-2010 09:58 PM
How can I put a message in a jsf page after an action in another page? guess85 Java 1 11-04-2007 02:12 PM
Why are labels handled differently than an input control with clie =?Utf-8?B?Y2NnYXR2b2x2bw==?= ASP .Net 2 08-01-2006 02:28 PM
Where to put page specific script in a page that inherits from a master page? Eric ASP .Net 0 04-24-2006 11:54 PM



Advertisments