.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net


I have one text box and that textbox should contain firstname.lastname.

I am doing Client side validation.

I am getting error Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object.

ASPX code :-

function validateTextBox(str)
         alert(str);// Getting proper value
        if (str.indexOf(".") == -1)
                alert("Username should have period(.) between firstName and LastName like FirstName.LastName or FirstNameMI.LastName");
               // Here i am getting error...
                return false;

View Complete Post

More Related Resource Links

Microsoft JScript runtime error: 'Parent' is null or not an object


Hi friends,

        I got This Error : Microsoft JScript runtime error: 'Parent' is null or not an object

 In runtime,after  click on the check box, It Show "Microsoft JScript runtime error: 'Parent' is null or not an object"

<script language ="javascript" type ="text/javascript" >
        function SelectAllCheckboxesSpecific(spanChk)
           var IsChecked = spanChk.checked;
           var items=0;
           var Chk = spanChk;
              Parent = document.getElementById('gvUsers');          
              var items = Parent.getElementsByTagName('input');                         
              for(var i=0;i<items.length;i++)
                  if(items[i].id != Chk && items[i].type=="checkbox")
                      if(items[i].checked!= IsChecked)

please verify it. 

jquery runtime error: Microsoft JScript runtime error: 'nodeName' is null or not an object


Microsoft JScript runtime error: 'nodeName' is null or not an object

in jquery-1.4.2.min.js 

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object referen



 i have a dropdownlist and Datagrid control on form. i wanted to refresh the grid

on changing  the DropDown OnSelectedIndexChanged, but when i do change

the dropdown value then it give me fallowing error message.

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

Can any one help me, how to solve this problem?

Code given below.


                <asp:DropDownList ID="ddColor" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddColor_SelectedIndexChanged"
                    <asp:ListItem Selected="True">Red</asp:ListItem>

Microsoft JScript runtime error: Object doesn't support this property or method



When I am updating dropdown of parent window from popup it shows error JScript runtime error. But I can able to clear the dropdown. When I am adding only the problem is occuring. I have pasted the code below

var ddlVendor = window.opener.aspnetForm.document.getElementById('ctl00_DefaultContent_ddlVendor');

//Clears the state combo box contents.

for (var count = ddlVendor.options.length-1; count >-1; count--)


ddlVendor.options[count] =


var stateNodes = listNode.getElementsByTagName('Table1/UserName');

var stateIds = listNode.getElementsByTagName('Table1/Password');

Microsoft JScript runtime error: Object required


have code

and i m getting an error( mentioned in title ) on line

browserdetect = textcontainerobj.filters ? "ie" : typeof textcontainerobj.style.MozOpacity == "string" ? "mozilla" : ""

please help 


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GFLN - Global Freight & Logistics Network</title>
<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG.js"></script>
<link href="css/styles.css" rel="stylesheet" type="text/css"/>
<!-- for left menu-->
<script type="text/javascript">

    var baseopacity = 0

    function showtext(thetext) {
        if (!document.getE

Microsoft JScript runtime error: 'net' is undefined.

I get an error at the statement new net.ContentLoader("MyPage.aspx") in Default.aspx page. I am using Visual Studio 2008 and .net framework 2.0.   Please help!

Microsoft JScript runtime error: 'ctl00_ContentPlaceHolder1_ProjectsList1_TextBoxSelectedP...' is

Hello,I have a repeater for html table rows. And inside the onclick of each row I wrote handleClick('somevalue');And here's my javascript handleClick() function:function handleRowClick(rowid) { var selectedvalue=<%=TextBoxSelectedProjectID.ClientID %>; selectedvalue.value = rowid; }  and the control I'm trying to update the value of is a textbox which is defined as follows:<asp:TextBox ID="TextBoxSelectedProjectID" runat="server" Style="display: none;"></asp:TextBox>The problem is: When I click on any row of my html table i get the javascript error telling me is it undefined.(just like the subject of this post)I looked at the generator html code at runtime and here it is: <div id="ctl00_ContentPlaceHolder1_ProjectsList1_mainlayout"> <input name="ctl00$ContentPlaceHolder1$ProjectsList1$TextBoxSelectedProjectID" type="text" id="ctl00_ContentPlaceHolder1_ProjectsList1_TextBoxSelectedProjectID" /> <table cellspacing="1" cellpadding="1" width="100%" onselectstart="return false;" style="background-color: #F8F8F8"> <tr id="fc82fbb858334ba480187cedfb19e88a" class="listRowNormal" onmouseup="handleRowClick('fc82fbb858334ba480187cedfb19e88a');"> <td s

'document.getElementById(...)' is null or not an object


i am making use of the following javascript at page_load event, to fill the default value of textbox, txtBuinessUserMailID at run time:

 void Page_Load(object sender, EventArgs e)//Initialize a stringbuilder object, much faster than string concatenation


Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts



  I am getting the following error while using ajax control tookit

Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

I am using Visual Studio 2008 with .Net Framwork 3.5 SP 1, i downloaded the Ajax Control Toolkit from codeplex (AjaxControlToolkit.Binary.NET35)

Below given is the markup:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

Getting "Microsoft JScript runtime" Error


I have added MaskedEditExtender and MaskedEditValidator controls from the Ajax Toolkit for .NET Framework 4.0 to my textboxes to provide enhanced functionality. However, since I've done that I am getting the following error in Visual Studio when I visit the page containing these controls.

Microsoft JScript runtime error: '2.length' is null or not an object

This is the information from the script page that Visual Studio breaks in.

When I right-click on the tab in Visual Studio and choose "Copy Full Path" it gives this.

When I hover over the tab in Visual Studio it gives this (as much as I could see in the tooltip).

This is the piece of code from line 21 of the file above, where Visual Studio breaks.

can't type a single key into login box Microsoft JScript runtime error:


I had to exclude several pages from my website to get it to run in vs 2008. When I finally got the home page to come up, I tried to type a character into the login box, and at the first character the probelm blows up:

Microsoft JScript runtime error: 'keyCode' is null or not an object

This is insanse. This is the page I'm on when it crashses. Does this have something to do with ajax?

<script type="text/javascript">
function onKeyPress (evt)
	var keycode;

	if (window.XMLHttpRequest)
		keycode = evt.keyCode;
		keycode = event.keyCode;



Microsoft JScript Runtime Error-Cannot Call Response .Write


i am simply doing a searching of records on button click if record found it will be display in gridview pther wise  it will print me a message no value found

but everytime when it execute my Else Block it always throws me this script error how i can resolve it

Currently Using Ajax Update Panel Script Manager C#

my Html

                    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:GridView ID="GridView1" runat="server" Width="385px">
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
        </asp:UpdatePanel> </td>

My Code Behind

protected void Button1_Clic

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: RAISEERROR


I'm getting this error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: You cannot add to the repair list until the barcode is added to Inventory first.

 Now the 'You cannot add to the repair list until the barcode is added to Inventory first.' is my own message being returned from

sql server.


I have a datagrid with a new button on it. When the user clicks on the button I insert a blank row in the grid. They then go to edit the record to put info in the grid.

Since the system is a barcode driven system, I check the barcode they entered to make sure it's in the system. If not I throw the message from sql server using the RAISEERROR event.

Here is the partial sql code:

	if not exists(select * from dbo.tblIndentification 
				where Identification_Barcode = @barcode) 
		RAISERROR(50020,11,1)  with NOWAIT
		return -1


Here  is the c# code:

                else if (e.CommandName.Equals("Update"))
                    //for use in conjuction when the user inserts a new row
                    if  (txtCurrentRowBeingEdited.Text=="")

CollapsiblePanelExtender - Microsoft JScript runtime error: Sys.InvalidOperationException js Error:


Dear All,

I am using a Master-detail gridview (gridview inside a gridview) and have a CollapsiblePanelExtender that opens the child gridview.

I have put the CollapsiblePanelExtender in the Itemtemplate of the parent gridview. Hence, for every item in the parent gridview, CollapsiblePanelExtender with duplicate id's are getting generated. I get this js error on load of the page: Microsoft JScript runtime error: Sys.InvalidOperationException: Two components with the same id 'cpe' can't be added to the application.

Below is  my html code:


    <form id="form1" runat="server">

    <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />

    <div id="dlg" style="width: 700px">

        <asp:Panel ID="pnlDFS" runat="server">

            <asp:GridView ID="gvDFSLinks" Width="100%" AllowPaging="True" AutoGenerateColumns="False"

                runat="server" ShowHeader="False" O

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

document.getElementById is null

Background I have a Firefox browser with many tabs opened. One of the tabs is displaying a website having data I want to scrape from. I want to take certain data values, compile statistics, and redisplay the information in a newly created popup. The other tabs are unimportant but it would be nice if I could work in others while I am gathering my data (focus moved away from the data window). When focus is on the tab with data, I execute an extension I am building from the tools menu. This starts my output popup window. At the bottom of the popup I have timer START and STOP buttons. When I push the START button, a timer starts controlling a periodic page scrape every few seconds. This webpage with the data is updated in real time via innerHTML which is why I need a timer to scrape the values every few seconds. CurrentlyAnyway, I can locate the window tab that has my data in javascrip.(not sure if this is pertinent or not.) I am confused though how JS knows what tab I am interested in to scrape my data from. I have tried using variants of document.getElementById() but no matter what I do the return is "null". Does somebody know enough to assist? I have taught myself how to do all this in a month so I am nubie all the way. Thanks !Additional Info I have tried the following and all give null returns. var x=window.opener.document.getElementById('active').innerHTML; var x=
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend