Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

I am having an user control with number of Controls.
I used this user control in a page.


Actually I want to validate the user control's control after my button in the page is clicked.

How will i get the clientId of the user control's control ?

Thanks in advance.!
Posted

Control.ClientID[^] provides access to the html ID tag/element attribute.

You can access the element using document.getElementById, or by binding to the submit event using jQuery: Bind an event handler to the "submit" JavaScript event[^]

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Mar-13 17:08pm    
Just the right line, a 5.
—SA
Espen Harlinn 12-Mar-13 17:27pm    
Thank you, Sergey :-D
its simple write code like this

JavaScript
var control = document.getElementById('UserControlName.ControlName');
// Example
var userControl = document.getElementById('userControl1_txt1');

here userControl1 is my Usercontrol and txt1 is my textbox control located in usercontrol, it'll return you an object.

Try this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900