Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI all ,
i have a lable on form and updateing its value using javascript by using innerHTML tag.

it shows correctly on the form.

now when i do click on save button and try to insert lable value in the database using lable.text it shows blank/ empty string.

not sure how to handle this ?
Posted
Comments
Sibasisjena 28-Feb-14 3:00am    
You have used ajax call/server side coding for saving the label value ?
ravikhoda 28-Feb-14 3:27am    
yeah

1 solution

hi
Try to get value with same way like ,lable.innerHTML or lable.innerText

Why u use innerHTML for update values in label just use

JavaScript
function newValue() {
var labelObj = document.getElementById("<%= errorMsg02.ClientID %>");
labelObj.value = "new val"; // assign new value for label
}


in above errorMsg02 is label
 
Share this answer
 
v2
Comments
ravikhoda 28-Feb-14 3:27am    
i dont know why but somehow lable.value not working in my code. that's why i use innerHTML.
Aravindba 28-Feb-14 3:33am    
u change label value using innerHTML tag so u cant get value in server side by using label.text,u need to use same label.innerHTML or innerText.

if u change label value using my way then u get label.text in server side
ravikhoda 28-Feb-14 3:40am    
alright let me try.
PJ003 28-Feb-14 4:52am    
Value of the label changed in javascript can not retrive updated value in server side code. It is very much achievable using hiddenfield.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900