Answered by:
Javascript Error when I run Ajax tool kit calendar

Question
-
User641305764 posted
Hi all,
I have issue with Ajax Toolkit in my project. When i run my webpage a javascript error is showing like
JavaScript runtime error: Unable to get property 'name' of undefined or null reference
Below is my code. Please review and let me know where i am missing.. I am facing this issue from couple of days ...
<%@ Page Title="" Language="C#" MasterPageFile="~/VirtualCRM.master" AutoEventWireup="true" CodeFile="Call.aspx.cs" Inherits="Call" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style2
{
font-size: large;
font-weight: bold;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p class="style2">Calls</p>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<table width="100%" frame="border">
<tr>
<td>
<asp:Label ID="lblSubject" runat="server" Text="Subject"></asp:Label>
<asp:Label ID="lblsubjct" runat="server" Text="*" ForeColor="Red"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSubject" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorSubject" runat="server" ErrorMessage="Enter Subject" ForeColor="Red" ControlToValidate="txtSubject"></asp:RequiredFieldValidator>
</td>
<td>
<asp:Label ID="lblStatus" runat="server" Text="Status"></asp:Label>
</td>
<td>
<asp:DropDownList ID="drpdwnStatus" runat="server">
<asp:ListItem>None</asp:ListItem>
<asp:ListItem>Planned</asp:ListItem>
<asp:ListItem>Held</asp:ListItem>
<asp:ListItem>Not Held</asp:ListItem>
<asp:ListItem>No Answered</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblDatetime" runat="server" Text="Date & Time"></asp:Label>
<asp:Label ID="lblDate" runat="server" Text="*" ForeColor="Red"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdate" runat="server"></asp:TextBox>
<asp:ImageButton ID="imgPopup" ImageUrl="~/calendar-128.png" ImageAlign="Bottom"
runat="server" Width="19px" />
<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="imgPopup" TargetControlID="txtdate" Format="dd/MM/yyyy">
</asp:CalendarExtender>
<asp:DropDownList ID="drpdwn1" runat="server">
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="drpdwn2" runat="server">
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>30</asp:ListItem>
<asp:ListItem>45</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="drpdwn3" runat="server">
<asp:ListItem>AM</asp:ListItem>
<asp:ListItem>PM</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidatordate" runat="server" ErrorMessage="Select Date" ForeColor="Red" ControlToValidate="txtdate"></asp:RequiredFieldValidator>
</td>
<td>
</td>
<td>
<asp:DropDownList ID="ddlTimeZone" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlTimeZone_SelectedIndexChanged"
AppendDataBoundItems="true" >
<asp:ListItem Text="Select a TimeZone" Value="Default value" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblDuration" runat="server" Text="Duration"></asp:Label>
<asp:Label ID="Duration" runat="server" Text="*" ForeColor="Red"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtduration" runat="server"></asp:TextBox>
<asp:DropDownList ID="drpdwndduration" runat="server">
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>30</asp:ListItem>
<asp:ListItem>45</asp:ListItem>
<asp:ListItem>60</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lbl" runat="server" Text="(hours/minutes)"></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorduration" runat="server" ErrorMessage="Enter Durationtime" ForeColor="Red" ControlToValidate="txtduration"></asp:RequiredFieldValidator>
</td>
<td>
</td>
<td>
Local Time: <asp:Label ID="lblLocalTime" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblDescription" runat="server" Text="Description"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Height="102px"
Width="266px"></asp:TextBox>
</td>
<td>
</td>
<td>
Converted Time: <asp:Label ID="lblTimeZone" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
<asp:Button ID="btnSave" runat="server" Text="Save"
onclick="btnSave_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel"
onclick="btnCancel_Click" />
</asp:Content>
I hope someone can help me out from this issue.
Regards,
Laxman
Tuesday, January 6, 2015 12:52 AM
Answers
-
User-1034726716 posted
Try uninstalling your AJAXControlToolkit and install the lasest one that is compatible to your .NET version.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, January 8, 2015 8:34 AM
All replies
-
User-1034726716 posted
Are you using any AjaxControlToolKit extenders in your other page? If so then try to move your ToolScriptManager declaration in your Site.Master instead.
Tuesday, January 6, 2015 6:54 AM -
User-1506965535 posted
Hi,
You are not using the syntax properly of the ajaxtoolkit calendar. Please see below for the syntax and check
<ajaxToolkit:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1"> </ajaxToolkit:CalendarExtender>
Tuesday, January 6, 2015 7:11 AM -
User-1034726716 posted
Hi,
You are not using the syntax properly of the ajaxtoolkit calendar. Please see below for the syntax and check
<ajaxToolkit:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1"> </ajaxToolkit:CalendarExtender>
Just wondering.. what's wrong with this syntax?
<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="imgPopup" TargetControlID="txtdate" Format="dd/MM/yyyy"> </asp:CalendarExtender>
Tuesday, January 6, 2015 8:48 AM -
User-1506965535 posted
Just wondering.. what's wrong with this syntax?I may be wrong, but i generally use the one which I posted. So gave that, nothing else.
Tuesday, January 6, 2015 8:59 AM -
User1918509225 posted
Hi pulipaka,
I suggest that you could check if your master page have one ScriptManager,If does,please remove it .
I have tested your code in my side ,it worked very well.
If you still have issue ,I suggest that you can post your master for me to test .
Best Regards,
Kevin Shen.
Tuesday, January 6, 2015 10:20 PM -
User-1034726716 posted
I suggest that you could check if your master page have one ScriptManager,If does,please remove it .I would suggest the other way. If the master page has ToolScriptManager then remove the other one from the Content page. ToolScriptManager should be in master page.
Wednesday, January 7, 2015 2:17 AM -
User641305764 posted
Hi all,
Sorry for late reply from me..
In my master page i dont have any ToolScriptManager. I just used in Calendar page. below is my Master page also..Please check once and let me know.
Master Page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="VirtualCRM.master.cs" Inherits="VirtualCRM" %>
<!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">
<head runat="server">
<title>Welcome to Virtual Office</title>
<script type="text/javascript" language="javascript">
window.onload = function () {
noBack();
}
function noBack() {
window.history.forward();
}
</script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.style1
{
width: 1266px;
}
.style2
{
width: 43%;
}
.style3
{
background-color: #66CCFF;
}
</style>
</head>
<body onpageshow="if (event.persisted) noBack();">
<form id="form1" runat="server">
<div align="left" style="background-color: #FFFF22">
<asp:Label ID="lblCurrentLoginUser" runat="server"></asp:Label>
</div>
<table width="100%" style="background-color: #FFFF22">
<tr>
<td align="center">
<asp:TextBox ID="txtsearch" runat="server" Width="224px" Height="22px"></asp:TextBox>
<asp:Button ID="Search" runat="server" Text="Search"/>
</td>
<td align="right">
<asp:Label ID="lblCurrentTime" Text="UserLoginTime=" runat="server"></asp:Label>
</td>
</tr>
</table>
<div align="right" style="background-color: #FFFF22">
<asp:Button ID="btnLogout" runat="server" Text="Logout" CausesValidation="false"
onclick="btnLogout_Click"/>
</div>
<div align="left" style="width:100%">
<table style="width:100%">
<tr>
<td class="style1">
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
BackColor="#FFFF3C" Width="100%"
style="font-size: X-large; font-style: normal; font-weight: 400;"
ForeColor="Black">
<StaticMenuItemStyle HorizontalPadding="20" />
<Items>
<asp:MenuItem Text="Home" Value="Home" NavigateUrl="~/VirtualCRM.aspx"></asp:MenuItem>
<asp:MenuItem Text="Get Started" Value="Get Started" NavigateUrl="~/GettingStarted.aspx"></asp:MenuItem>
<asp:MenuItem Text="Accounts" Value="Accounts" NavigateUrl="~/Account.aspx">
<asp:MenuItem Text="Create Account" Value="Createaccount" NavigateUrl="~/CreateAccount.aspx"></asp:MenuItem>
<asp:MenuItem Text="Accounts" Value="Accounts" NavigateUrl="~/Account.aspx"></asp:MenuItem>
<asp:MenuItem Text="Import" Value="Import" NavigateUrl="~/ImportAccount.aspx"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Contacts" Value="Contacts" NavigateUrl="~/Contacts.aspx">
<asp:MenuItem Text="Create Contact" Value="Create Contact" NavigateUrl="~/CreateContact.aspx"></asp:MenuItem>
<asp:MenuItem Text="Contacts" Value="Contacts" NavigateUrl="~/Contacts.aspx"></asp:MenuItem>
<asp:MenuItem Text="Import" Value="Import" NavigateUrl="~/ImportContact.aspx"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Opportunities" Value="Opportunities" NavigateUrl="~/Opportunities.aspx">
<asp:MenuItem Text="Create Opportunity" Value="Create Opportunity" NavigateUrl="~/CreateOpportunities.aspx"></asp:MenuItem>
<asp:MenuItem Text="Opportunities" Value="Opportunities" NavigateUrl="~/Opportunities.aspx"></asp:MenuItem>
<asp:MenuItem Text="Import" Value="Import" NavigateUrl="~/ImportOpportunities.aspx"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Leads" Value="Leads" NavigateUrl="~/Leads.aspx">
<asp:MenuItem Text="Create Leads" Value="CreateLeads" NavigateUrl="~/CreateLeads.aspx"></asp:MenuItem>
<asp:MenuItem Text="Leads" Value="Leads" NavigateUrl="~/Leads.aspx"></asp:MenuItem>
<asp:MenuItem Text="Import" Value="Import" NavigateUrl="~/ImportLeads.aspx"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Calendar" Value="Calendar">
<asp:MenuItem Text="Schedule Call" Value="Schedulecall" NavigateUrl="~/Call.aspx"></asp:MenuItem>
<asp:MenuItem Text="Schedule Meeting" Value="Schedulemeeting" NavigateUrl="~/Meeting.aspx"></asp:MenuItem>
<asp:MenuItem Text="Create Task" Value="Createtask" NavigateUrl="~/Task.aspx"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Documents" Value="Documents">
<asp:MenuItem Text="Create Document" Value="Create Document" NavigateUrl="~/CreateDocument.aspx"></asp:MenuItem>
<asp:MenuItem Text="Documents" Value="Documents"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="More" Value="More">
<asp:MenuItem Text="Campaign" Value="Campaign" NavigateUrl="~/Campaign.aspx"></asp:MenuItem>
<asp:MenuItem Text="Emails" Value="Emails"></asp:MenuItem>
<asp:MenuItem Text="Projects" Value="Projects"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Setting" Value="Setting" Selected="true">
<asp:MenuItem Text="User" Value="User"></asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>
</td>
</tr>
</table>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Thanks,
Laxman
Wednesday, January 7, 2015 5:21 AM -
User-1034726716 posted
I'm not quite sure but try moving your ToolScriptManager in your master page right after the <form> tag
Wednesday, January 7, 2015 6:12 AM -
User724169276 posted
Nadeem157
Hi,
You are not using the syntax properly of the ajaxtoolkit calendar. Please see below for the syntax and check
<ajaxToolkit:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1"> </ajaxToolkit:CalendarExtender>
Just wondering.. what's wrong with this syntax?
<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="imgPopup" TargetControlID="txtdate" Format="dd/MM/yyyy"> </asp:CalendarExtender>
Nothing . it depends upon the assembly tag prefix which is being declared in page directive. #Nadeem.
Wednesday, January 7, 2015 6:18 AM -
User724169276 posted
In content page try to change the tag name of ajax from asp to something else.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="aspAJAX" %>
Now change the ajax tools like this:
<aspAJAX:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1"> </aspAJAX:CalendarExtender>
Wednesday, January 7, 2015 6:22 AM -
User641305764 posted
Thank you...I try asp:calendar now i can able to insert date into textbox.
Wednesday, January 7, 2015 7:54 AM -
User724169276 posted
mark the post(s) which helped and close the thread.
Thanks.
Wednesday, January 7, 2015 7:56 AM -
User641305764 posted
HI all,
I am sorry for asking again same question.
In my project i am unable to use ajax toolkit. It showing javascript error. i dont understand why the javascript error is generating whenever i use Ajax toolkit in my project. Please find below error and let me know where i am missing my logic.
"JavaScript runtime error: Unable to get property 'name' of undefined or null reference"
Thanks,
Laxman
Thursday, January 8, 2015 8:20 AM -
User-1034726716 posted
Try uninstalling your AJAXControlToolkit and install the lasest one that is compatible to your .NET version.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, January 8, 2015 8:34 AM