473,474 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there a way to change the ClientID of a control?

I have a control whose ClientID is used in a number of Javascript routines.
It turned out that the ClientID has a dash (-) in it and breaks the JS. Is
there a way to change the ClientID of that control?
Nov 19 '05 #1
7 1504

"Stoyan Stratev" <no@email.set> a écrit dans le message de news:
eq**************@tk2msftngp13.phx.gbl...
I have a control whose ClientID is used in a number of Javascript routines.
It turned out that the ClientID has a dash (-) in it and breaks the JS. Is
there a way to change the ClientID of that control?


yes and no :

doing ipt.ID = "newid" in code behind will change the ID, but the name
will still be a built name with the resulting ClientID being of the form :
"parentID1_parentID2_newid".

this is apparently needed for ASP.Net to be able to rebuild control
hierarchies out of the postback information.

note that parentID1 will only be present if parent1 is with
runat="server", DOM nodes that are not runat="server" are ignored.
Nov 19 '05 #2
The ClientID should only get underscores, unless you have used a dash in the
ID of the control. ASP.NET uses underscores to concat ID's in the control
hierarchy to create unique ClientID's and colons to create unique form name
attributes (UniqueID).

Are you sure nothing in your control hierarchy has a dash in the ID?

Lars-Erik

"Stoyan Stratev" <no@email.set> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
I have a control whose ClientID is used in a number of Javascript routines.
It turned out that the ClientID has a dash (-) in it and breaks the JS. Is
there a way to change the ClientID of that control?

Nov 19 '05 #3
This happens in a DotNetNuke environment. I checked the chain of controls
and due to a bug in the DNN core the ID of the grandparent control contains
a dash. So I am pretty much stuck if I cannot modify my ClientID. Modifying
the grandparent's ID has no effect.
Nov 19 '05 #4
Hi again!

DotNetNuke is open source, isn't it? Can you do a search/replace on the
granparent's id and replace the dash with an underscore? (If you use the
binaries only, try getting the source and compile your own version)

L-E

"Stoyan Stratev" <no@email.set> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
This happens in a DotNetNuke environment. I checked the chain of controls
and due to a bug in the DNN core the ID of the grandparent control
contains
a dash. So I am pretty much stuck if I cannot modify my ClientID.
Modifying
the grandparent's ID has no effect.

Nov 19 '05 #5
Stoyan Stratev wrote:
I have a control whose ClientID is used in a number of Javascript
routines. It turned out that the ClientID has a dash (-) in it and
breaks the JS. Is there a way to change the ClientID of that control?


maybe you can change the JS:
instead of something like "document.elements.my-control-with-dashes.value",
use "document.elements["my-control-with-dashes"].value"
Or use getElementByID("my-control-with-dashes")

Hans Kesting
Nov 19 '05 #6
the problem is that I am distributing a skin object. This means that the
client has the javascript and Dotnetnuke already installed. I cannot modify
them. If I change the DNN core then all users would also have to recompile
the whole system which is not feasable.
It seems that I have to wait for the next release of DNN where they will
have (hopefully) the bug fixed.

"Lars-Erik Aabech" <la******@newsgroup.nospam> wrote in message
news:OM****************@TK2MSFTNGP10.phx.gbl...
Hi again!

DotNetNuke is open source, isn't it? Can you do a search/replace on the
granparent's id and replace the dash with an underscore? (If you use the
binaries only, try getting the source and compile your own version)

L-E

"Stoyan Stratev" <no@email.set> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
This happens in a DotNetNuke environment. I checked the chain of controls and due to a bug in the DNN core the ID of the grandparent control
contains
a dash. So I am pretty much stuck if I cannot modify my ClientID.
Modifying
the grandparent's ID has no effect.


Nov 19 '05 #7
Sounds like a plan, but check out Hans Kesting's answer to your post.. Might
work :)

L-E

"Stoyan Stratev" <no@email.set> wrote in message
news:eN**************@TK2MSFTNGP09.phx.gbl...
the problem is that I am distributing a skin object. This means that the
client has the javascript and Dotnetnuke already installed. I cannot
modify
them. If I change the DNN core then all users would also have to recompile
the whole system which is not feasable.
It seems that I have to wait for the next release of DNN where they will
have (hopefully) the bug fixed.

"Lars-Erik Aabech" <la******@newsgroup.nospam> wrote in message
news:OM****************@TK2MSFTNGP10.phx.gbl...
Hi again!

DotNetNuke is open source, isn't it? Can you do a search/replace on the
granparent's id and replace the dash with an underscore? (If you use the
binaries only, try getting the source and compile your own version)

L-E

"Stoyan Stratev" <no@email.set> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
> This happens in a DotNetNuke environment. I checked the chain of controls > and due to a bug in the DNN core the ID of the grandparent control
> contains
> a dash. So I am pretty much stuck if I cannot modify my ClientID.
> Modifying
> the grandparent's ID has no effect.
>
>



Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kw | last post by:
TextBox t=new TextBox(); Controls.Add(t); t.ID=t.ClientID; //reads: "_MyControl1__ctl16" And even in OnPreRender, I examine the Controls collection and verify that the ID of the TextBox is...
2
by: JJ | last post by:
Hi, Can anyone advise me how is the ClientID issued? I had a suite Controls which consist of a context menu (i.e. a group of tables, rows and cells situated in a class library) and a set of...
3
by: KCRichards59 | last post by:
I'm trying to change the text in a textbox when I roll over a hyperlink on the page. I know to use the "this.MyHyperlink.Attributes.Add("onMouseOver", "ChangeText()");" but I'm not sure if...
3
by: =?Utf-8?B?RXJpY2E=?= | last post by:
I have a lable control in a repeater and 2 link buttons. The lable is named lblCurrentPage and the link buttons are named "Prev" and "Next". Once the page is uploaded and viewed through the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.