Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 721697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:54:13+00:00 2026-05-14T05:54:13+00:00

I have a composite drop down calendar user control that consists of a textbox

  • 0

I have a composite drop down calendar user control that consists of a textbox and and calendar image and a validation control. I expose a property called “TextBox” on the usercontrol which returns a reference to the textbox used within the control. This is the textbox that the user enters the date into.

In the ASPX page, I have an instance of this usercontrol:

   <uc1:DropDownCalendar ID="dtmDateFirstEntry" runat="server"  Required="True" />

In my code behind, I want to detect when a user has tabbed off of the textbox and, using an UpdatePanel, referesh an appropriate message depending on the date that was specified.

Elsewhere in the ASPX page I have this:

   <asp:UpdatePanel ID="upIntendedStay" runat="server">
    <ContentTemplate>
        <asp:Label ID="Label4" runat="server" Text="Update this text from server" CssClass="ErrorText"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>

Here’s what I do in the code behind:

If Not Me.IsPostBack Then

    dtmDateFirstEntry.TextBox.AutoPostBack = True
    Dim trigger As New AsyncPostBackTrigger
    trigger.ControlID = dtmDateFirstEntry.TextBox.ClientID
    trigger.EventName = "onChange"
    upIntendedStay.Triggers.Add(trigger)

End If

When the page runs and I view the source, I see something like this:

<input id="ctl00_phPageContent_dtmDateFirstEntry_txtDate" class="DefaultTextBox" name="ctl00$phPageContent$dtmDateFirstEntry$txtDate" onchange="javascript:setTimeout('__doPostBack(\'ctl00$phPageContent$dtmDateFirstEntry$txtDate\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" style="width: 112px;" type="text" value="Mar-29-2010" />
<input id="ctl00_phPageContent_dtmDateFirstEntry_imgDate" name="ctl00$phPageContent$dtmDateFirstEntry$imgDate" src="images/calendar.JPG" style="border-width: 0px;" type="image" />&nbsp;

When I run it, I get this error:

A control with ID 'ctl00_phPageContent_dtmDateFirstEntry_txtDate' could not be found for the trigger in UpdatePanel 'upIntendedStay'. 

I didn’t think that the trigger control had to be within the UpdatePanel. I thought that was the whole point of adding the trigger.

How do I refresh this update panel changes to the text in the date usercontrol. Next I will have to add other triggers to trigger the refreshing of the Update Panel from other controls scattered across the page, so clearly all of the trigger sources cannot be within the UpdatePanel.

To try an simplify the situation, I added a test Textbox, textbox1 to the update panel:

 <asp:UpdatePanel ID="upIntendedStay" runat="server">
    <ContentTemplate>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Label ID="Label4" runat="server" Text="Update tHis text from server" CssClass="ErrorText"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>

I then get the error:

Could not find an event named ‘onchange’ on associated control ‘TextBox1’ for the trigger in UpdatePanel ‘upIntendedStay’.

OK, I added a textbox, TEXTBOX1, within the UpdatePanel, change “ClientId” to “ID” and “OnChange” to “TextChanged” and it works. But I still get the same error if the textbox is not within the UpdatePanel.

Must the triggering textbox be within the update panel? This is a crippling requirement.

Dim trigger As New AsyncPostBackTrigger
'trigger.ControlID = dtmDateFirstEntry.TextBox.ID '<<<<<<<<<<<<<<<<<<<<<
trigger.ControlID = TextBox1.ID
trigger.EventName = "TextChanged"
upIntendedStay.Triggers.Add(trigger)

OK..When I move athe calendar usercontrol into the Update panel, I get this error:

A control with ID ‘txtDate’ could not be found for the trigger in UpdatePanel ‘upIntendedStay’.

Hmmm. It’s apparently having an issue finding the embedded control even though it’s within the update panel, but it has no problem finding a plain textbox that is not embedded within a usercontrol!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:54:14+00:00Added an answer on May 14, 2026 at 5:54 am

    According what I understand the textbox is embedded on User Control dtmDateFirstEntry. You CANNOT use directly a control contained by a user control. The user control MUST expose the events of his child controls if you want to use them as triggers.

    <asp:UpdatePanel ID="upIntendedStay" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="dtmDateFirstEntry" EventName="DateChanged" />
        </Triggers>
        <ContentTemplate>
            <asp:Label ID="Label4" runat="server" Text="Update tHis text from server" CssClass="ErrorText"></asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>

    DateChanged would be an event exposed by dtmDateFirstEntry. Do you know how to do this?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a composite control that adds a TextBox and a Label control to
I have a composite control that contains a ListBox child control. On postback, the
I have a composite control which emits HTML that looks like this <span id=myControl>
I have a composite User control for entering dates: The CustomValidator will include server
I have a composite control that contains a different set of child controls based
I have a composite control that has a couple of private fields that reference
I have a composite control that has a large number of properties that can
I have a composite control on an ASPX page. There is Javascript on the
Using C# .NET 2.0, I have a composite data class that does have the
I have a Composite that I want to be able to enable/disable programatically. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.