This is a migrated thread and some comments may be shown as answers.

ClientIdMode support for ASP.NET 4.0

10 Answers 855 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Telerik Admin
Top achievements
Rank 1
Iron
Telerik Admin asked on 17 May 2010, 02:12 PM

A new feature implemented in ASP.NET 4.0 is the possibility to control the way that controls’ ClientID is generated. At present, RadControls for ASP.NET AJAX expect the ClientID’s of their child controls to be generated by the default method (AutoID). Because of that, if ClientIDMode is set to different method of generation you can experience various problems with RadControls, for example not working dialogs for RadEditor.

Here are some of the errors that you could experience when the ClientIDMode is set to Static:

All RadControls: Invalid JSON primitive:..
RadEditor's dialogs : Error: 'null' is null or not an object
RadEditor's dialogs : Sys.ArgumentNullException: Dialog Parameters for the FindAndReplace dialog do not exist  Parameter name: dialogueName.
RadFileExplorer: might not display the files in the folder
RadGrid : calling get_masterTableView() returns null
"Microsoft JScript runtime error: 'get_postBackElement().id' is null or not an object"

This problem is already added to our TODO list and it should be fixed for RadControls for ASP.NET AJAX Q2 2010. For the time being, we recommend to use ClientIDMode="AutoID" or if you have to use different method you should set the ClientIDMode property’s value explicitly to AutoID to the specific RadControl.

Additional information regarding this new .NET4.0 feature is available in the following article:
ASP.NET 4.0 ClientID Overview

Please note that Microsoft does not recommend setting ClientIDMode="Static" on pages which do contain dynamic controls.

Best regards,
The Telerik team

10 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 20 Jul 2010, 02:46 PM
Hello,
I've installed the Q2 2010 version however it does not appear that ClientIDMode is being implemented as expected by the Telerik controls. I have set ClientIDMode to both static and predictable, yet the tabs and text boxes being displayed are still rendered with ctl0_ctl0 prefixes. Would it be possible to get a clarifying statement with examples of the extent to which ClientIDMode is supported and what names will be generated? I've searched through the forum posts and read the release notes for Q2 2010 and its not very clear what or if is supported. From the release notes:

"Improved: Updated the RadControls which are naming containers to use the AutoID ASP.NET 4 ClientIdMode. Solves compatibility problems when mode is set globaly to Static"

Maybe I am misunderstanding, however it sounds to me like what that means is that the Telerik controls, or at least some of them which are not specified, will implement auto IDs, and by extension this will be implemented on their child controls, regardless of the mode set by the programmer using the controls.

I think however its setup its something we can work with if we can just get an understanding of how this is supposed to work so we don't lose time coding solutions only to find they are not compatible with an imprecise or misunderstood naming system.

Thank you!
0
nick
Top achievements
Rank 1
answered on 21 Jul 2010, 10:48 PM
It appears that Telerik is forcing their controls to use AutoID.  This is not the way MicroSoft intended controls to work, based on their documentation for the ClientIdMode property:

http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx

I truly believe that Telerik needs to rethink their implementation.  Otherwise they are completely removing the flexibility Microsoft introduced with this setting.
0
T. Tsonev
Telerik team
answered on 23 Jul 2010, 05:11 PM
Hi,

I'm copying the reply to Nick's bug report here for community reference:


Our motivation for forcing AutoID over Inherit is that neither Static nor Inherit work reliably when it comes to controls with complex hierarchies of child controls and templates. We've chosen to play it safe and keep the old behavior until we were certain that we can reliably support this new feature.

I agree that not being able to set the ClientIdMode explicitly is a bit excessive. We've logged this and we'll fix it for the SP1 release.

In the extreme case you can inherit any of the RadControls and override the ClientIDMode property.

Apologies for the caused inconvenience.


Sincerely yours,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Matt Smith
Top achievements
Rank 1
answered on 12 Aug 2010, 01:58 PM
I would also say that forcing the AutoID will break current applications which are using your current behaviour.

I don't know which the worse of the two evils.
0
David Rhodes
Top achievements
Rank 1
answered on 27 Mar 2013, 03:10 PM
Hi,

Was this ever fixed, i'm using RadAjaxManagerProxy in the 2013 controls and they only work for clientIDMode="AutoID", not Static
0
Maria Ilieva
Telerik team
answered on 01 Apr 2013, 08:31 AM
Hello David,

Please note that using Static ID mode for Rad Controls is not supported. You should use AutoID mode for the RadControls on the page especially when they are performing ajax requests..
Microsoft recommends using ClientIDMode=Static only for static control. RadControls on the other hand are controls with complex hierarchies of child controls and templates so setting their ClientID mode to static will break their functionality.

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kin
Top achievements
Rank 1
answered on 16 Jun 2015, 10:04 AM

Hi Maria,

is there possibility to set ClientIdMode to "Predictable" for all Telerik controls in project?

0
Maria Ilieva
Telerik team
answered on 19 Jun 2015, 08:31 AM
Hi Kin,

It is not possible to modify the ClientIDMode for only the Telerik controls on the page. You can globally set the ClietIDMode int he Page directive which will modify the mode for all the controls on the page.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kin
Top achievements
Rank 1
answered on 23 Jun 2015, 07:13 AM

If I set ClientIdMode globally on page level for example, then all controls except Telerik changes it modes,
but Telerik still uses it's own ClientIDMode :)
It some surprising me. Is it defect?

0
Maria Ilieva
Telerik team
answered on 25 Jun 2015, 02:53 PM
Hi,

Find attached a small test application where the ID mode is correctly set. Test it on your end and verify what the difference in your  case is.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Telerik Admin
Top achievements
Rank 1
Iron
Answers by
Mike
Top achievements
Rank 1
nick
Top achievements
Rank 1
T. Tsonev
Telerik team
Matt Smith
Top achievements
Rank 1
David Rhodes
Top achievements
Rank 1
Maria Ilieva
Telerik team
Kin
Top achievements
Rank 1
Share this question
or