Solved

Problem with the textbox

Posted on 2014-07-23
3
173 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
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…

803 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