Transforming 'plain' ID to 'adorned' ID

I must be missing something obvious here. Suppose I create an ASP.NET Web User Control, and I use a ModalPopupExtender inside it. In the ascx, I set various properties of the extender to refer to controls within the Web User Control, such as PopupDragHandleControlID="TitleText". At runtime, the control with ID "TitleText" gets a more complicated ID on the rendered page (call it an 'adorned' ID, not sure what the offical term is), such as "ctl00_ContentPlaceHolder1_MyCtrl1_TitleText". The behaviour javascript for the extender does things like -

this._dragHandleElement = $get(this._PopupDragHandleControlID);

That wouldn't work with the 'plain' ID, in fact by adding various alert() boxes I can see that _PopupDragHandleControlID has been transformed - somewhere - to the 'adorned' version. I've written an extender that declares and uses ID properties in just the same way, but they don't get transformed from the 'plain' version at runtime. So, I either have to use ugly workarounds like setting that ID programmatically from server-side code (e.g. MyExtender1.BlahID = MyBlahCtrl.ClientID), or ... figure out how to get that transformation to happen automatically like it seems to for ModalPopupExtender. Can anyone point me in the right direction?

(Note, I'm not talking about the TargetControlID property, so ResolveTargetControlID wouldn't come into it, and I'm talking about an extender that's right next to the controls in question.) 

Thanks in advance for any leads.

 

Kevin.

 

0
kevinf
4/18/2007 4:25:53 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

4 Replies
1033 Views

Similar Articles

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

All extender properties that reference ID's are decorated with the IDReferencePropertyAttribute. It helps converts server side ids into client versions so that the behavior can resolve them easily. If you look at the ModalPopupExtender.cs file, the PopupDragHandleControlID has that attribute and so so any other properties that are used to get control IDs.


Kirti Deshpande
Program Manager, Silverlight and ASP.NET AJAX
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
0
kirtid
4/18/2007 9:27:09 PM

Do you have any references that confirm that's so and detail where it occurs? The reasons I ask are 1. My extender's properties that ref IDs already have that attribute, and no such conversion occurs, and 2. The documentation for that attribute doesn't mention anything like that, merely that it can be used by designers to help out by giving a list of control IDs at design time - no mention of anything happening at runtime. But if that attribute is the answer and if you have more information on it, please do say so I can figure out why it isn't working for me.

Or does anyone else have details on how the conversion occurs for PopupDragHandleControlID et al?

 

Thanks in advance for any help

 

Kevin.

 

0
kevinf
4/18/2007 10:02:54 PM

It happens in ExtenderBaseDesignerHelpers.cs file. It is part of the Toolkit framework. If you are building on top of ExtenderControlBase this is taken care of automatically.

 Should have included these links earlier

http://ajax.asp.net/ajaxtoolkit/Walkthrough/CreatingNewExtender.aspx

http://ajax.asp.net/ajaxtoolkit/Walkthrough/ExtenderClasses.aspx


Kirti Deshpande
Program Manager, Silverlight and ASP.NET AJAX
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
0
kirtid
4/18/2007 11:01:11 PM

Aha. In fact, I had a hand-rolled extender built with ref to various online docs rather than one done as per that walkthrough, which when followed showed up I'd not got the ECB derivation stuff right. In the interim, I'd done some tracing through the ACT code and you're quite right, that attribute is used as a signal for the base classes to apply some transformation before serialising. Funny the docs don't mention that. Anyway, thanks for the pointers - it's running ok now.

Kevin.

 

0
kevinf
4/20/2007 10:22:13 PM
Reply:

Web resources about - Transforming 'plain' ID to 'adorned' ID - asp.net.ajax_control_toolkit

Resources last updated: 12/17/2015 8:11:42 PM