Hi what i want to do is to code a checkbox list. herewith i have attached an imaage.
as in the image, if i check business all the checkboxes below it should get checked and if i uncheck all the check box should get unchecked,
how do i code this in asp.net C#
This is jQuery. You can add this code at the bottom of your .aspx page just before the closing </body> tag within a set of <script> tags. However, if you include jQuery, you need to reference the jQuery library, typically in your <head> element, just before the closing </head> tag.
Are you familiar with jQuery?
I would suggest placing the reference to jQuery just before the closing </head> element. This will ensure that if any other jQuery code is added on this page, the jQuery library would already be loaded...and most likely the visitor would have already visited a site that is referencing this library so, the browser will load it from cache.
Another technique that is common is to wrap the jQuery block within a ready method.
Having the reference at the bottom will allow the page to render completely, before running any scripts that might need running. If I remember correctly, the page will stop rendering, if it encounters a script reference, to only continue when its been cached or ready to use. Something to think about when you have a script heavy page.
But for normal pages top or bottom will work fine.
@ggamble- I agree with your suggestion. I generally add scripts down just before the closing </body> tag. However, I generally add the reference to jQuery in the <head> section. I'll do some additional reading based upon your explanation. thanks!
More than likely it is because the checkboxes do not have the class associated with it via the cssclass="sub" tag. You also need to give the All checkbox a class and instead of referencing the business checkbox via the #business way you would need to reference it via the class name with a period.