Click here to Skip to main content
15,909,896 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When i click reset button it gives message
"JavaScript runtime error: Unable to set property 'innerHTML' of undefined or null reference"

my code is as follows whats wrong in that code:-

C#
var lblDisplayCount;
lblDisplayCount = document.getElementById("lblCountNumber");

document.getElementById('<%= lblCountNumber.ClientID %>').innerHTML = lblDisplayCount;
Posted
Updated 3-Jun-15 18:13pm
v4
Comments
DamithSL 4-Jun-15 1:56am    
what is lblCountNumber? is it asp.net label control?

1 solution

if you need to clear label value, do as below
HTML
document.getElementById('<%= lblCountNumber.ClientID %>').value = '';
 
Share this answer
 
Comments
Sonakshi Sharma 4-Jun-15 2:04am    
after reset when i click on submit button it gives following error
"Unable to set property 'value' of undefined or null reference" to document.getElementById('<%= lblCountNumber.ClientID %>').value = ''; this line
DamithSL 4-Jun-15 2:17am    
what is lblCountNumber? is it asp.net label control?
Sonakshi Sharma 4-Jun-15 4:24am    
yes

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