Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Problem with the textbox

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
HuaMinChen
Asked:
HuaMinChen
1 Solution
 
Miguel OzSoftware EngineerCommented:
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
 
HuaMinChenBusiness AnalystAuthor Commented:
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
 
Kelvin McDanielSr. Developer/ConsultantCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now