I've just moved one of my older applications to a new server. Several pages have some quite complicated client-side Javascript which no longer fires.
I traced this to the control IDs (controls on a panel in a page inheriting a Master Page) being generated differently, and realised I needed to set the Page property "ClientIDMode" to "Auto" - tried that on test server, worked fine. Put it back in the dev
copy and now the dev copy won't even build...
System.Web.UI.Page does not have a public property named 'clientidmode' (error is all lower case and not how it is in the file)
Apparently it needs to go in the web.config file in the pages section. However that won't accept that property either, it does not exist.
So I have an app that runs fine on the server and won't build on the client.
I would go back and recode it to dynamically pump out the client side Javascript using the newer technique to reference the controls by getting their IDs in the code-behind, but I really don't have time. The Javascript is quite involved and I really don't
want to change it right now.
How do I get this so it works both on the server and on my test machine, as the two approaches - Page and Web.Config aren't working...
As the above person said, ClientIDMode supports only for .net framework 4.0 and higher. For older versions, you have to use the below in javascript code to get the correct client ID at runtime.
DTMarkDotInf...
Member
17 Points
32 Posts
ClientIDMode property
Sep 11, 2012 11:36 PM|LINK
I've just moved one of my older applications to a new server. Several pages have some quite complicated client-side Javascript which no longer fires.
I traced this to the control IDs (controls on a panel in a page inheriting a Master Page) being generated differently, and realised I needed to set the Page property "ClientIDMode" to "Auto" - tried that on test server, worked fine. Put it back in the dev copy and now the dev copy won't even build...
System.Web.UI.Page does not have a public property named 'clientidmode' (error is all lower case and not how it is in the file)
Apparently it needs to go in the web.config file in the pages section. However that won't accept that property either, it does not exist.
So I have an app that runs fine on the server and won't build on the client.
I would go back and recode it to dynamically pump out the client side Javascript using the newer technique to reference the controls by getting their IDs in the code-behind, but I really don't have time. The Javascript is quite involved and I really don't want to change it right now.
How do I get this so it works both on the server and on my test machine, as the two approaches - Page and Web.Config aren't working...
Thanks.
hassanmehmoo...
Star
8970 Points
1590 Posts
Re: ClientIDMode property
Sep 12, 2012 06:42 AM|LINK
The reason is becuase ClientIDMode property is supported only in Framework 4 and 4.5
Read more about it : http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx
--
Hope this helps..
Mark as Answer, if it answers you..
--
Ruchira
All-Star
44332 Points
7194 Posts
MVP
Re: ClientIDMode property
Sep 12, 2012 08:28 AM|LINK
Hello,
As the above person said, ClientIDMode supports only for .net framework 4.0 and higher. For older versions, you have to use the below in javascript code to get the correct client ID at runtime.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.