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

To set value to server control(asp.net, label control) in javascript

--------javascript function--------
Expand|Select|Wrap|Line Numbers
  1. function setvalue()
  2. {
  3. var empfname=document.getElementById('<%=TxtempFname.ClientID >').value;
  4.  
  5.  if(empfname=="")
  6.    {
  7.     document.getElementById('<%=LabelValidMsg.ClientID %>').value="please   insert First Name";
  8.  
  9.     document.getElementById('<%=TxtempFname.ClientID %>').focus();
  10.    }
  11. }
  12.  
--------asp.net---------
Expand|Select|Wrap|Line Numbers
  1. page load()
  2. { if ( !page.isPostBack)
  3.   {submitBtn.attributes.add("onclick", setvalue());}
  4. }
  5.  
i am checking the value in textbox. if it is empty den setting value of label and sending cursor back to textbox. mine coding is not working(not setting value in label). how i can do it?
Oct 5 '07 #1
2 6602
acoder
16,027 Expert Mod 8TB
What is the label? If it's not got a value attribute, you'll need to use innerHTML instead.

Don't forget to use code tags when posting code:

[CODE=javascript]
JavaScript code...
[/code]
Oct 5 '07 #2
dabei
4
Can you try to debug it with Firebug ?
Oct 5 '07 #3

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

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...
1
by: Thierry | last post by:
Hi, Is it possible to get the value of an asp:dropdownlist in javascript. I need to get that value to assign it to a hyperlink. This does not work:...
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...
2
by: John Holmes | last post by:
I would like to turn on a label control in javascript with the onfocus event of another control by setting the Visible property to true. When I try and reference this label control it says...
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...
4
by: pagates | last post by:
Hello All-- I have a number of <asp:Label CssClass="someclass">Text</asp:Labelcontrols on my page. I would like them to be shown as <div class="someclass">Text</div> rather than <span...
4
by: Guy Noir | last post by:
So, I have a table that I only want to appear after some event has fired. Using the asp:table control and the Visible property, this is a piece of cake. The problem is that when I try and drop a...
2
by: pavankumar106 | last post by:
can anyone tell me how to get the value of asp:label in javascript?
0
by: pavankumar106 | last post by:
can anyone tell me how to get the value of asp:label in javascript.. the label is in datalist and i need the value of it?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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?
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.