Solved

Problem with the textbox

Posted on 2014-07-23
3
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

752 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