What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 6388 |  Welcome, Guest!   Register  Login
 Home > Forums > JavaScript > How to Solve JavaScript NULL Error ...
Sivakumar.S

How to Solve JavaScript NULL Error

Replies: 2 | Posted by: Sivakumar.S on 6/1/2012 | Category: JavaScript Forums | Views: 406 | Status: [Member] | Points: 10  


Hi,

In Javascript, i am getting null error while the values are checking in the loop. For your information, in my project i already get the element id and after that through that id, i am checking the value is nothing. That time the error is displaying. How can i solve this null error, pls guide me..

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

txtCtrl = document.getElementById('<%=txtRECornealReflex.ClientID%>');

if (txtCtrl.value == "")


$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

The Error is like: Error: 'value' is null or not an object
code:0

siva


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Gaur1982
Gaur1982  
Posted on: 6/1/2012 3:30:18 AM
Level: Starter | Status: [Member] | Points: 25

Please improve this code and check it first i.e. txtCtrl is not equl to null....
txtCtrl = document.getElementById('<%=txtRECornealReflex.ClientID%>');

if (txtCtrl.value == "")


Corrected code
txtCtrl = document.getElementById('<%=txtRECornealReflex.ClientID%>');

if (txtCtrl != null)
{
if (txtCtrl.value == "")
....
....



Gaurav Agrawal
http://planetofcoders.com/

Sivakumar.S, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Ajay.Kalol
Ajay.Kalol  
Posted on: 6/4/2012 1:15:05 AM
Level: Starter | Status: [Member] | Points: 25

txtCtrl = document.getElementById('<%=txtRECornealReflex.ClientID%>');

if (txtCtrl != null && txtCtrl != undefined)
{
if (txtCtrl.value == "")
....
....
}


rewrite your Code Like this.

Enjoy

http://ajaypatelfromsanthal.blogspot.in

Sivakumar.S, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 10:32:03 AM