473,387 Members | 1,515 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,387 software developers and data experts.

AutoUpdate Label Control?

I was able to do this in .asp but not asp.net, can someone please help.

I have a multi-line textbox control on a webform. Next to it is a label
control. Basically I want the label control to automatically reflect the
contents of the textbox control. I did this through script before. The
following is the script I am using now.

<script language=javascript>

setInterval('UpdateMemoDisplay()', 1000);

function UpdateMemoDisplay() {
lablCause.innerHtml = formDownTime.textCause.innerText;

formDownTime.textResolution.innerText = formDownTime.textCause.innerText;
}
</script>

The first line of the function doesn't work but the second one does. Of
course the second one does me no good, I just put it in there to make sure I
wasn't crazy. So if I can update another TextBox, why can I not update a
Label control? I realize it is technically a Span but I would expect it to
work.

Any suggestions or insite on why it doesn't and can't work?

--
Thanx,
Grigs
Nov 19 '05 #1
7 1279
Grigs wrote:
lablCause.innerHtml = formDownTime.textCause.innerText;

Any suggestions or insite on why it doesn't and can't work?


Have you checked the source in the browser if lablCause is part of the page?

Depending on how complex your page is and if lblCause is a server
control its clientID might differ from its name which essentially breaks
your JS function.

Daniel

Nov 19 '05 #2
What do you expect and what do you observe?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
I was able to do this in .asp but not asp.net, can someone please help.

I have a multi-line textbox control on a webform. Next to it is a label
control. Basically I want the label control to automatically reflect the
contents of the textbox control. I did this through script before. The
following is the script I am using now.

<script language=javascript>

setInterval('UpdateMemoDisplay()', 1000);

function UpdateMemoDisplay() {
lablCause.innerHtml = formDownTime.textCause.innerText;

formDownTime.textResolution.innerText = formDownTime.textCause.innerText; }
</script>

The first line of the function doesn't work but the second one does. Of
course the second one does me no good, I just put it in there to make sure I wasn't crazy. So if I can update another TextBox, why can I not update a
Label control? I realize it is technically a Span but I would expect it to work.

Any suggestions or insite on why it doesn't and can't work?

--
Thanx,
Grigs

Nov 19 '05 #3
It is within the <form> tag if that is what you are getting at. I have tried
it both as a RunAt=Server and without with the same results.

"Daniel Buchholz" wrote:
Grigs wrote:
lablCause.innerHtml = formDownTime.textCause.innerText;

Any suggestions or insite on why it doesn't and can't work?


Have you checked the source in the browser if lablCause is part of the page?

Depending on how complex your page is and if lblCause is a server
control its clientID might differ from its name which essentially breaks
your JS function.

Daniel

Nov 19 '05 #4
The point of it is to take whever the user types in the TextBox and have it
encoded it into HTML in the Label. Thus is someone types "Hello
<b>World</b>" in the text box it would come out as Hello World (and the World
would be bold.

As I said in the first post, it passes the text okay to another text box (of
course it can't handle the HTML) but does nothing to the label.

Kevin

"Eliyahu Goldin" wrote:
What do you expect and what do you observe?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
I was able to do this in .asp but not asp.net, can someone please help.

I have a multi-line textbox control on a webform. Next to it is a label
control. Basically I want the label control to automatically reflect the
contents of the textbox control. I did this through script before. The
following is the script I am using now.

<script language=javascript>

setInterval('UpdateMemoDisplay()', 1000);

function UpdateMemoDisplay() {
lablCause.innerHtml = formDownTime.textCause.innerText;

formDownTime.textResolution.innerText =

formDownTime.textCause.innerText;
}
</script>

The first line of the function doesn't work but the second one does. Of
course the second one does me no good, I just put it in there to make sure

I
wasn't crazy. So if I can update another TextBox, why can I not update a
Label control? I realize it is technically a Span but I would expect it

to
work.

Any suggestions or insite on why it doesn't and can't work?

--
Thanx,
Grigs


Nov 19 '05 #5
So you are not getting any errors, are you? Could it be browser-related?
What browser are you using?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
The point of it is to take whever the user types in the TextBox and have it encoded it into HTML in the Label. Thus is someone types "Hello
<b>World</b>" in the text box it would come out as Hello World (and the World would be bold.

As I said in the first post, it passes the text okay to another text box (of course it can't handle the HTML) but does nothing to the label.

Kevin

"Eliyahu Goldin" wrote:
What do you expect and what do you observe?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
I was able to do this in .asp but not asp.net, can someone please help.
I have a multi-line textbox control on a webform. Next to it is a label control. Basically I want the label control to automatically reflect the contents of the textbox control. I did this through script before. The following is the script I am using now.

<script language=javascript>

setInterval('UpdateMemoDisplay()', 1000);

function UpdateMemoDisplay() {
lablCause.innerHtml = formDownTime.textCause.innerText;

formDownTime.textResolution.innerText =

formDownTime.textCause.innerText;
}
</script>

The first line of the function doesn't work but the second one does. Of course the second one does me no good, I just put it in there to make sure
I
wasn't crazy. So if I can update another TextBox, why can I not
update a Label control? I realize it is technically a Span but I would expect

it to
work.

Any suggestions or insite on why it doesn't and can't work?

--
Thanx,
Grigs


Nov 19 '05 #6
Here is a dumbed-down version of the code which should work. In this example
you will see the second text box get updated as you type but the span will
not.

<html>
<head>
<script language="javascript">
function UpdateMemoDisplay() {
lablTest.innerHtml = textTest.value;
textTest2.value = textTest.value;
}
</script>
</head>
<body>
<textarea id="textTest" name="textTest" cols="50" rows="5"></textarea>
<br>
<span id="lablTest">This is a TEST</span>
<br>
<textarea id="textTest2" name="textTest2" cols="50" rows="5"></textarea>
</body>
<script language="javascript">
setInterval('UpdateMemoDisplay()', 1000);
</script>
</html>
"Grigs" wrote:
No browser errors. Using IE 6 sp2.
I tried it in Firefox and get no errors, but nothing goes into the TextBox

"Eliyahu Goldin" wrote:
So you are not getting any errors, are you? Could it be browser-related?
What browser are you using?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
The point of it is to take whever the user types in the TextBox and have

it
encoded it into HTML in the Label. Thus is someone types "Hello
<b>World</b>" in the text box it would come out as Hello World (and the

World
would be bold.

As I said in the first post, it passes the text okay to another text box

(of
course it can't handle the HTML) but does nothing to the label.

Kevin

"Eliyahu Goldin" wrote:

> What do you expect and what do you observe?
>
> Eliyahu
>
> "Grigs" <Gr***@discussions.microsoft.com> wrote in message
> news:1F**********************************@microsof t.com...
> > I was able to do this in .asp but not asp.net, can someone please

help.
> >
> > I have a multi-line textbox control on a webform. Next to it is a

label
> > control. Basically I want the label control to automatically reflect

the
> > contents of the textbox control. I did this through script before.

The
> > following is the script I am using now.
> >
> > <script language=javascript>
> >
> > setInterval('UpdateMemoDisplay()', 1000);
> >
> > function UpdateMemoDisplay() {
> > lablCause.innerHtml = formDownTime.textCause.innerText;
> >
> > formDownTime.textResolution.innerText =
> formDownTime.textCause.innerText;
> > }
> > </script>
> >
> > The first line of the function doesn't work but the second one does.

Of
> > course the second one does me no good, I just put it in there to make

sure
> I
> > wasn't crazy. So if I can update another TextBox, why can I not

update a
> > Label control? I realize it is technically a Span but I would expect

it
> to
> > work.
> >
> > Any suggestions or insite on why it doesn't and can't work?
> >
> > --
> > Thanx,
> > Grigs
>
>
>


Nov 19 '05 #7
No browser errors. Using IE 6 sp2.
I tried it in Firefox and get no errors, but nothing goes into the TextBox

"Eliyahu Goldin" wrote:
So you are not getting any errors, are you? Could it be browser-related?
What browser are you using?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
The point of it is to take whever the user types in the TextBox and have

it
encoded it into HTML in the Label. Thus is someone types "Hello
<b>World</b>" in the text box it would come out as Hello World (and the

World
would be bold.

As I said in the first post, it passes the text okay to another text box

(of
course it can't handle the HTML) but does nothing to the label.

Kevin

"Eliyahu Goldin" wrote:
What do you expect and what do you observe?

Eliyahu

"Grigs" <Gr***@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
> I was able to do this in .asp but not asp.net, can someone please help. >
> I have a multi-line textbox control on a webform. Next to it is a label > control. Basically I want the label control to automatically reflect the > contents of the textbox control. I did this through script before. The > following is the script I am using now.
>
> <script language=javascript>
>
> setInterval('UpdateMemoDisplay()', 1000);
>
> function UpdateMemoDisplay() {
> lablCause.innerHtml = formDownTime.textCause.innerText;
>
> formDownTime.textResolution.innerText =
formDownTime.textCause.innerText;
> }
> </script>
>
> The first line of the function doesn't work but the second one does. Of > course the second one does me no good, I just put it in there to make sure I
> wasn't crazy. So if I can update another TextBox, why can I not update a > Label control? I realize it is technically a Span but I would expect it to
> work.
>
> Any suggestions or insite on why it doesn't and can't work?
>
> --
> Thanx,
> Grigs


Nov 19 '05 #8

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

Similar topics

7
by: Mike Casey | last post by:
Hello all, I have ASP.NET label controls tied to a datasource (so text will vary in length depending on the record). In IE everything looks great--text is wrapped if needed. In Netscape and...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
6
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it...
8
by: Arpan | last post by:
Consider the following code snippet (my main intention is to display the current time in a Label control as & when this ASPX page is accessed/refreshed): <script runat="server"> Class Clock...
2
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub ShowData(obj As Object, ea As EventArgs) lblDate.Text = DateTime.Now.ToString("d") lblDate.DataBind() End Sub </script> <form...
12
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the...
4
by: pradeep | last post by:
how to set input type label's value through javascript
5
by: BobLaughland | last post by:
Hi There, I am trying to get some fields to align on a web page, like this, To: From: Subject: Each of the fields above have a corresponding asp:Textbox control next to it that I cannot...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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,...
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...

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.