Solved

Problem with the textbox

Posted on 2014-07-23
3
174 Views
Last Modified: 2014-07-24
Hi,
with these codes
<%@ Page Title="Test" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="App7._Default" ValidateRequest="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" TargetControlID="tb_reg_date" %>
...
                <asp:TextBox ID="tb_reg_date"
                    width="170px"
                    Font-Names="Times New Roman" 
                    Font-Size="11pt" 
                    Font-Bold="true"
                    ForeColor="DarkBlue"
                    runat="server" />
                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" 
                    TargetControlID="DateTextBox" Format="MMMM d, yyyy">
                </cc1:CalendarExtender>
                ...

Open in new window

I get this

Server Error in '/App7' Application.

Parser Error 
  Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

 Parser Error Message: The 'targetcontrolid' attribute is not supported by the 'register' directive.

Source Error: 



Line 1:  <%@ Page Title="Test" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="App7._Default" ValidateRequest="false" %>
Line 2:  <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" TargetControlID="tb_reg_date" %>
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Line 4:  <html xmlns="http://www.w3.org/1999/xhtml">
  

 Source File:  /App7/Default.aspx    Line:  2 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446  

Open in new window

why?
0
Comment
Question by:HuaMinChen
3 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 40216101
The error means that TargetControlID is not a valid construct for the "Register" directive.

Just remove the following "TargetControlID="tb_reg_date"" from line 2  and if your Ajax library is installed correctly, the page error will be gone.
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40216112
Sorry, with these
<%@ Page Title="??????" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="App7._Default" ValidateRequest="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
...
                <asp:TextBox ID="tb_reg_date"
                    width="170px"
                    Font-Names="Times New Roman" 
                    Font-Size="11pt" 
                    Font-Bold="true"
                    ForeColor="DarkBlue"
                    runat="server" />
                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" 
                    TargetControlID="DateTextBox" Format="MMMM d, yyyy">
                </cc1:CalendarExtender>
                ...

Open in new window

I still get this

Server Error in '/App7' Application.

The TargetControlID of 'CalendarExtender1' is not valid. A control with ID 'DateTextBox' could not be found. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.InvalidOperationException: The TargetControlID of 'CalendarExtender1' is not valid. A control with ID 'DateTextBox' could not be found.

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 



[InvalidOperationException: The TargetControlID of 'CalendarExtender1' is not valid. A control with ID 'DateTextBox' could not be found.]
   System.Web.UI.ExtenderControl.RegisterWithScriptManager() +512
   AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) +24
   System.Web.UI.Control.PreRenderRecursiveInternal() +113
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297

  


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446  

Open in new window

0
 
LVL 11

Accepted Solution

by:
azarc3 earned 195 total points
ID: 40216757
Change this...

<cc1:CalendarExtender ID="CalendarExtender1" runat="server" 
                    TargetControlID="DateTextBox" Format="MMMM d, yyyy">
                </cc1:CalendarExtender>

Open in new window


... to this...

<cc1:CalendarExtender ID="CalendarExtender1" runat="server" 
                    TargetControlID="tb_reg_date" Format="MMMM d, yyyy">
                </cc1:CalendarExtender>

Open in new window

0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question