Child Control ID Problem

A

Ashish Kaila

Hello All,
I am having trouble with client side events in a composite webcontrol.
Basically when I add a button as a child, setting its id as Button_0_0, the
html source adds the <controlid>_ in front of the actual Button_0_0 id. Now
when the postback occurs from Button_0_0, the id recieved in OnBubbleEvent
is Button_0_0 but when I try to add a client script from a link control
referencing Button_0_0 or <controlid>_Button_0_0 javascript reports an error
saying object not found. Anyone has any clue of whats going wrong ?
Thanks,
Ashish Kaila
 
D

Drew Robbins

You can use the control's ClientID property to reference the control in
client script. The ClientID is the identifier as it is assigned to the
HTML control in the page output.
 
D

Drew Robbins

How are you trying to access the control? I typically use something like
the following javascript to get a reference to the control...

var controlElement = document.getElementById('<Control.ClientID>');

Replace the <Control.ClientID> token with the string returned from your
control's ClientID property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top