AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 How to Use javascript in asp.net User Control
Posted by Prabhakaran on  2/14/2008 11:01:46 PM Category: ADO.NET
Add to my favorites
Email to friend
hi

how to use javascript events use in asp.net Usercontrols

Post Your Reply Post New Question

 Viewer's Reply
Use usual Javascript function in User Control
Answered By Moderator1 on 2/15/2008 7:54:34 PM
Hi,

You can write usual javascript functions in the Web User Control between the <script></script> tag. The only thing you have to consider is the name of the controls.

That is to get a value of a Textbox which id is 'TextBox1', you usually use like
document.getElementById('TextBox1').value

But this will not work at all times. That is the client id may change in some situation. Better you can use the below syntax to overcome that situation.

document.getElementById('<%=TextBox1.ClientID%>').value

Thanks
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Windows 8: 50 Questions and Answers You Need to Make a Decision (Normally $9.95)
Introduction to Web Applications Development
The Beginner's Guide to Joomla