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

Top 5 Contributors of the Month
Post New Web Links

document.getElementById not working

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

This is ASP .Net 4.0 code.  After the statement var t1 = document.getElementById("TextBox1");
is executed, t1 is null. Why is t1 null? Is there to fix it?

<asp:Content ID="Content1" ContentPlaceHolderID="Content1" runat="server">
    <script type="text/javascript" language="javascript">
        function Show1() {
            var t1 = document.getElementById("TextBox1");

    <asp:Panel ID="Panel5" runat="server">
        <div id="Div2" runat="server">
            <asp:TextBox ID="TextBox1" name="TextBox1" runat="server"></asp:TextBox>

View Complete Post

More Related Resource Links

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

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=

"max-template-document-size" change not working as expected

Hi There I have a 2 node MOSS 2007 deployment hosting 5 webapps. The one web app I am having a problem with is a customised solution from a 3rd party. The product users need to save sites as templates, to which they get an error saying that the template is too large. I have run the max-template-document-size stsadm command and increased the value from 5mb to 50mb but it seems the change is not taking effect. The error page says the limit is still 5mb. When I use stsadm getproperty it shows that the value has in fact increased. I have made sure that I am doing this on the correct webapp. The save as template operation works if I do not select the "save content" option. The sites have no content so the cannot be greater than 50mb. Am I missing something extremely obvious?

Read-Only mode is not working for office document-Bug

I have a excel file in the document library. In client PC I have office 2007. Suppose two users click on that excel file. A small window pops up to select mode(edit or read-only). User1 selects edit and user 2 selects read-only. user1 made some modificatin on the document. After that save and close the file. Now user2 click on save button he also can save the file. That means modification made by user1 is overridden by user2. So it should not happen. It's a Bug. If the user opening the document in Read-Only mode then save button should be in disable mode. If any one has any workaround. Please let me know.

'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


Document Set not working from a Site/Library Template


Hi all,

found a strange bug ...

Created a site in SharePoint 2010, added the document set content type to a document library.  I then created some standard document sets within the document library to use in a site template.

However, when I created a new site from the site template the document sets appear as folders, with no document set info section when you go into them.  However when you do the drop down on the name in the library it shows "Document Set Version History".

It is as though the document sets were only half recreated.  I can create a new document set in the same library and that shows as it should.

Anyone else come across this?  Anyone have any tips or solutions? Incidentally the document sets are also not working when a new library is created from a library template.  They have the correct icon, but the link that has been automatically created does not work.

Oh, you can create new document sets within the newly created library (within site template or from a library template) and they work fine.  It is only document sets that are saved within the templates.

When looking at a document library from a template that included a document set the link to the document set itself has been recreated completely wrong.

This is the link on the original document set

Breakpoints Not Working in VS2008: "No symbols have been loaded for this document."



Unfortunately, I can't get my breakpoints to work when in debug mode in Visual Studio 2008 (ASP.NET 3.5, Windows 7, IIS7). The website compiles and opens in debug mode, but the breakpoints themselves generate the following error message:

"The breakpoint will not currently be hit. No symbols have been loaded for this document."

There are some recommended solutions online, but for various reasons, either they haven't applied or I haven't been able to make them work. I've been trying to find the solution for about 12 hours now, and I'm getting desperate. Any help would be much appreciated.

Thanks in advance!

(Note 1: This problem is specific to this website. I do have other websites that I open in VS2008 where the breakpoints work fine.)

(Note 2: There is only one website/project associated with this problem. This website does not have multiple projects.)

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



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;

Whats difference between $find and document.getElementbyID???


Whats difference between $find and document.getElementbyID???

I'm using both and I see no difference.

Document ID feature not working



I want to try out the Document ID feature.
I enabled the "Document ID" feature in the Site Collection features list.

That gave me a new setting "Document ID settings" in the "Site Collection Administration" list.
I checked "assign document ids", I specified a prefix, and checked the "reset all document ids..."

I did this last friday, and today there is still no sign of document ids in my document library.
When I check existing documents, or upload new documents, there is no field "document id" when I check the properties.
This column is also missing when I modify or create a new view.

Any ideas what I need to check to get this working ?
I have beta 2 installed (14.0.4536.1000).
Maybe it is a know issue with this version ?

document.getElementById("div5") has no properties


Error: document.getElementById("div5") has no properties


i have a div element but i get the above error msg in firefox

how do i rectify

Sharepoint 2007 "New Document" hyperlink not working


I am using Windows 7 Ultimate, Sharepoint 2007, latest version of IE8 and Office Professional 2010 (including Infopath 2010).  I have Form Libraries (Infopath forms) and when I go into the form library and click on New>New Document, nothing happens.  The menu folds up so that I just see New with the drop down arrow, but there is no browser error or anything else displayed, and Infopath 2010 never opens with the .xsn template. 

I did not have this issue on my previous platform of XP SP3, Sharepoint 2007, IE7 and Office Professional 2007 (including Infopath 2007)

document.getelementbyid IE 8


hi everyone 
I have this piece of code it works perfect in firefox and Chrome but when i try to run it at IE8 it says 
Error: 'document.getElementById(...)' is null or not an object 
i know that has its own way to interpret javascript,but i've tried everything as :
-write the server name of the object  '<%= inpHide.ClientID %>'  this is how works in other browsers 

Find Control inside a View of Multiview using Javascript (document.getElementById)



i am using the multiview control inside a page and i am trying to find a control using the javascript function document.getElementById. My Problem is that the function returns null cause it cannot find the control. When i open the code of the page from the browser the active view is not rendered so I think thats the reason why I am getting a null value from the function. 

On the HTML code is rendered only the first view or the view that is activated on page load.

Is there any way to find a control inside the view using javascript? or I am doing something wrong?

Thanks a lot.

Version Comments not working for document Upload on Document Library.


Hello Friends,

I have custom list definition for my document library on a WSS site. I have enabled Versioning on that document library. I can able to see version comments when i use "Check-in/Check out" of the documents in the library. But when i use "Upload" option of the document library its asks for version comments But it is not displayed on the version history page. As a whole "Version comments" are not captured when i use upload option on the library.Kindly help me to fix this issue. Thanks.


Document copy from one Document Library to Another isn't working.



I have a document in a document library (Library A) and have created a custom field (a choice) called "Document Status." The choices are "Draft," "Product," "Review," and "Final."

I have a When the Document is changed, and the Document Status field is "Final," SharePoint begins a Workflow that should be copying the Current Item document into Library B. However, it's not working.

Here's a link to what I've done in Sharepoint Designer.


Does anyone have a suggstion?



"Date Modified" not working in Explorer View if document is created in Explorer View


Windows 7 SP1 with Webclient (webdav), Office 2010 Professional Plus, connects to a Sharepoint 2010 Document Library, using Explorer View, mapped to a disc drive letter. Document library has check out requirement turned off.

Customers work only in Windows Explorer with Webclient, they dont want to use web interface to Sharepoint.

Information to recreate the problem:

CASE1) Let's say a new docx document is created in Explorer View (in Explorer by  right-click-new Word document). Customer waits couple of minutes, enters and changes the document in Explorer View, and then saves it and closes Word. Result: Column "Date Modified" in Explorer view is unchanged, when it should have been changed. (!)

CASE2) Let's say I created new docx document in Web View (all documents view). Customer waits couple of minutes, enters the same document IN EXPLORER VIEW, changes it and then saves it and closes Word. Result: Column "Date Modified" in Explorer view is CHANGED to the new save time so now it works!

Why is this happening and is there any fix for this. Is this problem of WebDAV or of Sharepoint? It happends with .docx and .xlsx files, and not with .txt files and some othes which work correct when created in Explorer View.

Also when I copy/paste to Explorer View , column Date

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