Error using the PopupControlExtender control when referencing controls that are contained within another control...

I'm running into an issue when using the PopupControlExtender control. It appears the if the TargetControlID or control you are targeting is inside another ASP.NET control you can not access the control b/c the ID of the control when the page renders is differnt. It appears that you also can not use the <%# control.UniqueID %> method b/c the PopupControlExtender does not support DataBinding.

An example of my problem...
I have a wizard control. Inside that wizard control is a textbox called TextBox1. I want to add a popup calendar to that textbox by using the PopupControlExtender control. I then set the TargetControlID="TextBox1". But when I run the page I get this error: "Target control with ID 'TextBox1' could not be found for extender 'Extender1'. If I add another textbox outside of the Wizard control the page will display with no errors. Is there anyway around this?

Thanks,
Steve

0
von
4/19/2006 6:53:18 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

2 Replies
1223 Views

Similar Articles

[PageSpeed] 56
Get it on Google Play
Get it on Apple App Store

Yes - the extenders have the side effect of exposing the semantics of control relationships in ASP.NET.

As you've discovered, the Extender needs to be able to find the target control.  It's actually not an issue of the ID changing when the page renders (we handle that) but rather an issue of locating the target by name in order to know what that client ID will be.

The classic way you see this issue is in repeater controls - you can't reference things inside the repeater from out side it either - for basically the same reason.

The solution here is to make sure the extender and the thing that's being extended are in the same naming scope.  So in your case, just put the extender in the same container as the TextBox control.

For an example of this, see the HoverMenu demo page.

 


Don't forget, this posting is provided "AS IS" with no warranties, and confers no rights.
0
sburke_msft
4/19/2006 7:17:26 PM

That worked! Thanks!

0
von
4/19/2006 7:56:23 PM
Reply: