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

how to pass some text to Label in the page using javascript

indianmaestro
Hi
i want to display some text on the label when i select an item int he listbox.
for this i have written some code which is workint fine in the InternetEplore but when it comes to mozilla the text not showing

my coding is like this

document.getElementById('<%=lblcnt.ClientID%>').in nerText="1 Student(s) selected";

help me
Mar 11 '08 #1
2 3495
Hi
i want to display some text on the label when i select an item int he listbox.
for this i have written some code which is workint fine in the InternetEplore but when it comes to mozilla the text not showing

my coding is like this

document.getElementById('<%=lblcnt.ClientID%>').in nerText="1 Student(s) selected";

help me
Try
document.getElementById('<%=lblcnt.ClientID%>').in nerHTML
instead
Mar 11 '08 #2
Frinavale
9,735 Expert Mod 8TB
Hi
i want to display some text on the label when i select an item int he listbox.
for this i have written some code which is workint fine in the InternetEplore but when it comes to mozilla the text not showing

my coding is like this

document.getElementById('<%=lblcnt.ClientID%>').in nerText="1 Student(s) selected";

help me
When you're adding items to your ListBox, set the ListItem's onClick attribute to execute the JavaScript that will display the text in the text box:

.NET code
Expand|Select|Wrap|Line Numbers
  1. //populating list
  2. With MyListBox.Items
  3.     .Add(New ListItem("ItemA","text for A"))
  4.     .Add(New ListItem("ItemB","text for B"))
  5.     .Add(New ListItem("ItemC","text for C"))
  6. End With
  7.  
Expand|Select|Wrap|Line Numbers
  1. For Each li As ListItem In RBtnL_DateOptions.Items
  2.             li.Attributes.Add("onclick", "javascript: displayText('"+myLabel.ClientID+"','"+li.Attributes.Add("onclick", li.Text)+"');")
  3.         Next
  4.  

Then write a the JavaScript function that displays the text:

Expand|Select|Wrap|Line Numbers
  1. function displayText(labelID,textValue)
  2. {/*something like*/
  3.      document.getElementById(labelID).value = textValue;
  4. }
  5.  
See How to check if a textbox contains a number for instructions on how to add the JavaScript to the browser using .NET.

-Frinny
Mar 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
3
by: Allan Lembo | last post by:
Hi Folks If I create a new instance of an object within a method how can I pass it back by reference? For example, the following code, in the context of an ASP.NET page, returns "Original...
13
by: Benjamin Smith | last post by:
I am controlling the display status of a table row using the following code. <TR id="CCRow" style="DISPLAY:none"> Instead of hard coding "none" above, I would like to change that value using a...
1
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the...
5
by: mark_hanson_eng | last post by:
How can I best pass user selected text to the server on a button click? I could use javascript document.selected and add javascript to a asp:button using Attributes.Add. Ideally I would fill the...
3
by: Joao Batista | last post by:
Hi all, I have a MasterPage with a menu, populated from a database, my problem now is when i chose an option , how can i pass (catch) the value to my products page??? Thanks Joao Batista
0
by: weiwei | last post by:
Hi; I am having trouble to get variable from grid view. here is my scenario. I want to delete a row in database from web page, in additon, I also want to delete that user's directory in c:drive. ...
4
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
2
by: Moiseszaragoza | last post by:
I am not sure if this goes in here ot the ASP forum I have been trying to get some simple AJAX on my site but its not going so well I am not sure what my problems is what i am trying to do is...
3
by: swetha123 | last post by:
hello, I don't know how to use cookies please help me in this I am using the dream weaver cs4 I designed the navigation bar to my page using dream weaver cs4 navigation bar contains...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.