473,778 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=javasc ript>

setInterval('Up dateMemoDisplay ()', 1000);

function UpdateMemoDispl ay() {
lablCause.inner Html = formDownTime.te xtCause.innerTe xt;

formDownTime.te xtResolution.in nerText = formDownTime.te xtCause.innerTe xt;
}
</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 1296
Grigs wrote:
lablCause.inner Html = formDownTime.te xtCause.innerTe xt;

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***@discussi ons.microsoft.c om> wrote in message
news:1F******** *************** ***********@mic rosoft.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=javasc ript>

setInterval('Up dateMemoDisplay ()', 1000);

function UpdateMemoDispl ay() {
lablCause.inner Html = formDownTime.te xtCause.innerTe xt;

formDownTime.te xtResolution.in nerText = formDownTime.te xtCause.innerTe xt; }
</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.inner Html = formDownTime.te xtCause.innerTe xt;

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***@discussi ons.microsoft.c om> wrote in message
news:1F******** *************** ***********@mic rosoft.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=javasc ript>

setInterval('Up dateMemoDisplay ()', 1000);

function UpdateMemoDispl ay() {
lablCause.inner Html = formDownTime.te xtCause.innerTe xt;

formDownTime.te xtResolution.in nerText =

formDownTime.te xtCause.innerTe xt;
}
</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***@discussi ons.microsoft.c om> wrote in message
news:DC******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:1F******** *************** ***********@mic rosoft.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=javasc ript>

setInterval('Up dateMemoDisplay ()', 1000);

function UpdateMemoDispl ay() {
lablCause.inner Html = formDownTime.te xtCause.innerTe xt;

formDownTime.te xtResolution.in nerText =

formDownTime.te xtCause.innerTe xt;
}
</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="javas cript">
function UpdateMemoDispl ay() {
lablTest.innerH tml = textTest.value;
textTest2.value = textTest.value;
}
</script>
</head>
<body>
<textarea id="textTest" name="textTest" cols="50" rows="5"></textarea>
<br>
<span id="lablTest">T his is a TEST</span>
<br>
<textarea id="textTest2" name="textTest2 " cols="50" rows="5"></textarea>
</body>
<script language="javas cript">
setInterval('Up dateMemoDisplay ()', 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***@discussi ons.microsoft.c om> wrote in message
news:DC******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
> news:1F******** *************** ***********@mic rosoft.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=javasc ript>
> >
> > setInterval('Up dateMemoDisplay ()', 1000);
> >
> > function UpdateMemoDispl ay() {
> > lablCause.inner Html = formDownTime.te xtCause.innerTe xt;
> >
> > formDownTime.te xtResolution.in nerText =
> formDownTime.te xtCause.innerTe xt;
> > }
> > </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***@discussi ons.microsoft.c om> wrote in message
news:DC******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:1F******** *************** ***********@mic rosoft.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=javasc ript>
>
> setInterval('Up dateMemoDisplay ()', 1000);
>
> function UpdateMemoDispl ay() {
> lablCause.inner Html = formDownTime.te xtCause.innerTe xt;
>
> formDownTime.te xtResolution.in nerText =
formDownTime.te xtCause.innerTe xt;
> }
> </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
2933
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 Opera, the text extends horizontally and does not wrap. Any ideas would be most appreciated! Thanks,
6
6935
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 about a LiteralControl and a Label? Other than the lack of being able to format the Literal control's text, I don't see much of a difference in the documentation. TIA, --
31
7247
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
3163
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 works fine, it seems to fire when the form changes visibility. Here is the code. Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint If lblP1JoyUp.Visible = True Then Dim...
8
1931
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 Sub SetTime(ByVal intSec As Integer, ByVal intMin As Integer, ByVal intHour As Integer) Dim lblTime As New System.Web.UI.WebControls.Label lblTime.Text = "Current Time: " & intHour & ":" & intMin &
2
3855
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 runat="server"> <asp:Label ID="lblDate" OnDataBinding="ShowData" runat="server"/>
12
13277
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 same Tag number. (I thought it might help) The checkboxes name is a concatenation of "chkCancel" and a number that represents the order in which they were created: chkCancel0 (Tag = 0) chkCancel1 (Tag = 1)
4
24448
by: pradeep | last post by:
how to set input type label's value through javascript
5
11804
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 get to lign up. I have this code,
0
9470
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
10298
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
10127
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
10069
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
9923
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
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2865
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.