First up, apologies for the length of this question!
I have a page with several web user controls on them two of which are somewhat interdependent. In an ideal world they could be one control but for various reasons they need to be two.
I need to update an update panel in one of the controls based on the action of a dropdownlist in another control, as described below.
For this purpose we will call the controls JobControl and CallControl. JobControl contains a dropdown list, which is part of a Cascading Dropdown list from the AJAXControlToolkit. When this dropdown has a selected index change I want to update the control panel in CallControl.
CallControl exposes it's update panel as such:
public UpdatePanel UpdatePanel
{
get { return updCall; }
}
JobControl has a public member AssociatedCallControl
private ServiceCallControl associatedCallControl;
public ServiceCallControl AssociatedCallControl
{
get { return associatedCallControl; }
set { associatedCallControl = value; }
}
The two are then associated together in the OnLoad event of the page containing the controls.
This SO Question: Update Panel error: Control with the ID "xxx" could not be found in the UpdatePanel led me to try this in the onload event of the JobControl:
if (associatedCallControl != null)
{
AsyncPostBackTrigger trig = new AsyncPostBackTrigger();
string s = ddCallGroup.ClientID;
//ddCallGroup is the dropdown I want to trigger the update of the CallControl
trig.ControlID = ddCallGroup.ClientID; //Also Tried ddCallGroup.ID
trig.EventName = "CallGroupChanged";
associatedCallControl.UpdatePanel.Triggers.Add(trig);
}
With the following also added to the JobControl
public void CallGroupChanged(object sender, EventArgs e)
{
//Stuff to update the CallControl panel including calling update();
associatedCallControl.RefreshMehods(int.Parse(ddCallGroup.SelectedValue));
}
Hover after all this I still get A control with ID 'TabContainer1_tabJob_ctrlJob_ddCallGroup' could not be found for the trigger in UpdatePanel 'updCall'.
Am I attempting the impossible? Am I going about this the wrong way or have I just missed something?