Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi All,

I have a couple of tables named Category and Subcategory. They consist of all categories and where in sub category table consist of all subcategory of each category. These are entered in the Master form.

I have a web form in which I have to bind all categories in a check box,
when each category check box is checked I have to bind its respective subcategory in another check box list. Same way I have to bind all Subcategories in each category checked true.

While saving I have to save all subcategories and categories but I have a problem with how I identify which subcateogry belongs to which category.
Posted
Updated 7-Dec-10 23:49pm
v4
Comments
Tarun.K.S 8-Dec-10 1:48am    
Use <pre> tags only for code blocks.
senguptaamlan 8-Dec-10 2:18am    
The requirement is not very clear....it will be helpful if you write the requirement in a crisp and clear way
TweakBird 8-Dec-10 2:25am    
Cross post by same user : http://www.codeproject.com/Questions/134148/using-check-box-list-in-each-checkbox-checked-its-.aspx
Rajesh Anuhya 8-Dec-10 3:38am    
Not clear

1 solution

When you generate your checkboxes be sure to craft a name for them that is representative of the ID of the category/subcategory that is being rendered. When your form is returned to the server (POSTed) you will be able to read the value of the name.

If you are using ASP.NET and MVC I have a post[^] on advanced model binding where I address this issue head-on.

Cheers.
 
Share this answer
 
Comments
karthikkushala 9-Dec-10 1:10am    
thanks for ur solution i may go for first solution am notusing MVC model .plz can u suggest me wht are the uses by using MVC wht is MVC .
TheyCallMeMrJames 9-Dec-10 8:46am    
Model-View-Controller - MVC is a framework that allows you to create the entitles that you want to work with, the presentation that you wish to display and the functionality that binds them together in separate development areas. Because of it's implementation, it also makes it very easy to work with client-side javascript libraries rendering tasks like your fairly trivial. The post in my answer above is part of a series on ASP.NET MVC and jQuery and accomplishes what you are looking for. Cheers.

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