'"event = event || window.event" Member not found. RequiredFieldValidator
Recently, we upgraded our website from .NET 3.5 to 4.0. After doing so, we noticed something very weird happening in legacy versions of IE. IE9 in standards view works as designed, however, any other version of IE gives us a weird error when typing into an asp textbox with a RequiredFieldValidator. In a .NET anonymous function that is found, we get the "Member not found." script error on this line:
event = event || window.event;
I've searched everywhere but have not found a solution. This only happens when we type in the textbox, and only on this page. Any help would be appreciated. This only happens in older version of IE, other browsers and IE9 seem to handle it perfectly fine.
Solution 1:[1]
Are you accessing event || window.event inside setTimeout function? if so, by that time the even might have lost and accessing the event will give you 'member not found' error..
Solution 2:[2]
Since you haven't posted your code, we can only guess what is going on.
The line throwing error is fine (assuming event being in function arguments), probably error is caused by the next line. IE throws Member not found error message, when you try to retrieve non-existing property of the event object.
I suppose there is keyup or keydown handler in your script, having a line something like this:
if (event.which == 13){ ... }
However, there is no which property in event object in older IEs, corresponding property is keyCode. So you need to check both:
var key=event.which || event.keyCode;
if (key == 13){ ... }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tgvrs santhosh |
| Solution 2 | Teemu |
