ITemplate Controls within a User Control can't be found by UpdatePanel Trigger

I have a user control with an ITemplate. I have my user control dropped onto a page inside an UpdatePanel. Inside the template I have a button which I want to cause a full postback. When I add the button to the postback triggers of the UpdatePanel the UpdatePanel can't find the control and I get a runtime error of: A control with ID 'cmdUploadManual' could not be found for the trigger in UpdatePanel 'upManageManuals'. Is there anyway to build my user control so that controls within the template can be found?
LVL 1
puterartAsked:
Who is Participating?
 
DropZoneConnect With a Mentor Commented:
Controls within a templated control cannot be accessed at design-time because the template is parsed at run-time.  Also, there is no direct access to the controls within the template, and you'll have to search for them.  You then will have to register your event programmatically.  For example (C#):

    object cmdButton = upManageManuals.FindControl("cmdUploadManual");
    if (cmdButton != null) {
        cmdButton.Click += new System.EventHandler(upManageManuals_CmdClick);
    }

I hope this helps.

     Cheers!
    -dZ.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.