UserControl and IDs

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

I have a web control that contains some JavaScript and HTML tags (div, tables, etc.). Everything works fine if I only have one control on a page, but as soon as I have two controls, the IDs in both the HTML tags and JavaScript references are incorrect. How can I have "dynamic" IDs in the HTML tags? How can I make the whole more dynamic?

Thanks in advance for any suggestion.
Mike
 
Hi Mike,

Thanks for your posting. As for the problem you mentioned, I have some
further things to confirm:
1. Is the control you're developing a ASCX WebUserControl or a Custom
WebServer Control?

2. Is the client javascript manipulating some sub controls in your control?

Also, generally, we can use the Control.ClientID to get the actual id
which will be rendered to the client side.

Control.ClientID Property
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlCl
assClientIDTopic.asp?frame=true

#note that we should call the Control.ClientID after the control is added
into a certain parent control( which is already added into the page's
control tree), other wise the ClientID may not return the correct value.

In addition, if you still feel anything unclear or confused, I'd recommed
that you provide some detailed code of your controls so that we can do some
further steps on this.

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi Mike,

Have you had a chance to check the suggestions or have you got any further
progress on this issue?
If there is anything else we can help, please feel free to post here.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top