Solved

Problem with the textbox

Posted on 2014-07-23
3
170 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now