ASP.NET How do I add javascript function to a control? -


I have some user controls that I want to add some client-side functionality.

Say 1 controls have a bunch of hidden areas and checkboxes. When a checkbox is checked, it sets the hidden field to 'yes'. How can I get that control in the hosting control or page, and I can call some functions on that hidden area Will return the value of?

If I have some of these on the page, I like being able to:

  var option 1 = $ mill ('options1_id') if (options1. Dirty () = 'yes') // get whatever option 2 = $ ('options2_is') if (options2.dirty () = 'yes') // whatever  

I'm looking for something like this: but I'm not sure how to use the object from the parents.

Thank you, Mark

I take this issue in you Is that ASP.Net can confuse the ID of Control?

In the situation that I usually do, it either takes care of how the id is entangled for simple pages, and according to this is to write javascript or for more complex scenarios, .clientID each property of control and put it into a custom script variable which can be accessed easily for the rest of the JavaScript on the page.

It should be as easy, and the element of every control javascript is one of my complaints with the ASP.NET framework. They are doing something to solve it in the next version, although not as much as they could. In the mean time, you can find different components on the Web which will help automate the script described above.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -