Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Code is:

XML
<script type="text/javascript">
  function clear(){
     var labelObj = document.getElementById("<%= lbler.ClientID %>");

if (labelObj.innerHTML !="")
{
    labelObj .innerHTML="";
   }

  }
</script>

When label is Null initially ,then javascript throws an error Null or object already Null
how to prevent this error
Posted

1 solution

You should call the Clear() method only when the page loads.
From the error, it looks like the code is called during page load which should not happen in the first place.
 
Share this answer
 
Comments
Deepak Manuja 15-Mar-12 4:47am    
actually clear() method is called at tabcontainer's OnClientActiveTabChanged Event.

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