Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6618223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:48:09+00:00 2026-05-25T20:48:09+00:00

I have a calendar control that is hosted on an iframe. I get a

  • 0

I have a calendar control that is hosted on an iframe. I get a javascript error when I click on a date on the calendar. window.top.document.getElementById(..) is null or not an object

The iframe is hosted on another page ConfigSettings.aspx

The code in the calendar control code behind is:

Dim sjscript As String = "<script language=""javascript"" type=""text/javascript"">"
sjscript &= "window.top.document.getElementById('" & HttpContext.Current.Request.QueryString("DateTextID") & "').value = '" & Calendar1.SelectedDate & "';"
sjscript &= "window.top.document.getElementById('" & HttpContext.Current.Request.QueryString("DateTextID") & "1').style.display = 'none';"
sjscript = sjscript & "</script" & ">"
Literal1.Text = sjscript  

The html code is:

<input type="text" class="TextBox" id="ToDate" runat="server"/>
    <a href="javascript:ShowCalendar('ToDate1')"><img src="images/Calendar.jpg" border="0" /></a>
                    <iframe src="Calendar.aspx?DateTextID=ToDate" style="display:none; width:200px; height:100px" name="ToDate1" id="ToDate1"></iframe>
<asp:Label runat="server" ID="lblEndTime" Text="End Time:"></asp:Label>

What would be causing the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:48:09+00:00Added an answer on May 25, 2026 at 8:48 pm

    You’re calling “getElementById()” but not checking to see if it’s actually found anything. In other words, if no element on the top page has the “id” value you’re looking for, the return value from that function will be null. Your code does not check for that eventuality, however.

    edit — to check for null, I’d do something like this:

    var dateText = window.top.document.getElementById( ... whatever ... );
    if (dateText !== null)
      dateText.value = ... whatever ... ;
    else
      alert("cannot find date element");
    

    Another possibility is that “window.top” is not really the right window. If there’s another layer of <iframe> involved, then “window.top” would skip over the parent of the <iframe> in the code you posted. You might try changing it to “window.parent” instead of “window.top” and see if that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net calendar control that is used to select a date and
I have a databound calendar control that loads the date from the database. The
I have a composite drop down calendar user control that consists of a textbox
Can the calendar control be customsised so that, say you have a system of
I have an ASP.Net web user control that contains a TextBox and a calendar
In one of our project, we would like to have a calendar control that
Mine is c# web application. I have a calendar control that defaults to today
I have a textbox that is wired up to a calendar control like so
I have been looking for a javascript (hopefully jQuery) timezone chooser/picker/control widget that I
I need to have the Calendar Control start 36 hours after the current date.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.